diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs | 8 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetCache.cs | 7 | ||||
-rw-r--r-- | OpenSim/Framework/Util.cs | 27 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 10 |
4 files changed, 27 insertions, 25 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs index 62e18c4..748f20a 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs | |||
@@ -444,15 +444,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
444 | 444 | ||
445 | public static string Base64ToString(string str) | 445 | public static string Base64ToString(string str) |
446 | { | 446 | { |
447 | UTF8Encoding encoder = new UTF8Encoding(); | ||
448 | Decoder utf8Decode = encoder.GetDecoder(); | ||
449 | try | 447 | try |
450 | { | 448 | { |
451 | byte[] todecode_byte = Convert.FromBase64String(str); | 449 | return Util.Base64ToString(str); |
452 | int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); | ||
453 | char[] decoded_char = new char[charCount]; | ||
454 | utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0); | ||
455 | return new String(decoded_char); | ||
456 | } | 450 | } |
457 | catch | 451 | catch |
458 | { | 452 | { |
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 73aa6ba..e0d0bd7 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs | |||
@@ -34,6 +34,7 @@ using log4net; | |||
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenMetaverse.Packets; | 35 | using OpenMetaverse.Packets; |
36 | using OpenSim.Framework.Statistics; | 36 | using OpenSim.Framework.Statistics; |
37 | using System.Text; | ||
37 | 38 | ||
38 | namespace OpenSim.Framework.Communications.Cache | 39 | namespace OpenSim.Framework.Communications.Cache |
39 | { | 40 | { |
@@ -334,7 +335,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
334 | { | 335 | { |
335 | AssetInfo assetInf = new AssetInfo(asset); | 336 | AssetInfo assetInf = new AssetInfo(asset); |
336 | 337 | ||
337 | ProcessRecievedAsset(IsTexture, assetInf); | 338 | ProcessReceivedAsset(IsTexture, assetInf); |
338 | 339 | ||
339 | if (!m_memcache.Contains(assetInf.FullID)) | 340 | if (!m_memcache.Contains(assetInf.FullID)) |
340 | { | 341 | { |
@@ -389,8 +390,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
389 | } | 390 | } |
390 | } | 391 | } |
391 | 392 | ||
392 | protected void ProcessRecievedAsset(bool IsTexture, AssetInfo assetInf) | 393 | protected void ProcessReceivedAsset(bool IsTexture, AssetInfo assetInf) |
393 | { | 394 | { |
394 | } | 395 | } |
395 | 396 | ||
396 | // See IAssetReceiver | 397 | // See IAssetReceiver |
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index ba19dc6..cce2adb 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -342,7 +342,7 @@ namespace OpenSim.Framework | |||
342 | /// <returns></returns> | 342 | /// <returns></returns> |
343 | public static string Md5Hash(string pass) | 343 | public static string Md5Hash(string pass) |
344 | { | 344 | { |
345 | MD5 md5 = MD5CryptoServiceProvider.Create(); | 345 | MD5 md5 = MD5.Create(); |
346 | byte[] dataMd5 = md5.ComputeHash(Encoding.Default.GetBytes(pass)); | 346 | byte[] dataMd5 = md5.ComputeHash(Encoding.Default.GetBytes(pass)); |
347 | StringBuilder sb = new StringBuilder(); | 347 | StringBuilder sb = new StringBuilder(); |
348 | for (int i = 0; i < dataMd5.Length; i++) | 348 | for (int i = 0; i < dataMd5.Length; i++) |
@@ -419,7 +419,7 @@ namespace OpenSim.Framework | |||
419 | output.Append(": "); | 419 | output.Append(": "); |
420 | } | 420 | } |
421 | 421 | ||
422 | output.Append(CleanString(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1))); | 422 | output.Append(CleanString(Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1))); |
423 | } | 423 | } |
424 | else | 424 | else |
425 | { | 425 | { |
@@ -532,7 +532,7 @@ namespace OpenSim.Framework | |||
532 | /// <returns>safe path</returns> | 532 | /// <returns>safe path</returns> |
533 | public static string safePath(string path) | 533 | public static string safePath(string path) |
534 | { | 534 | { |
535 | return Regex.Replace(path, @regexInvalidPathChars, string.Empty); | 535 | return Regex.Replace(path, regexInvalidPathChars, String.Empty); |
536 | } | 536 | } |
537 | 537 | ||
538 | /// <summary> | 538 | /// <summary> |
@@ -542,7 +542,7 @@ namespace OpenSim.Framework | |||
542 | /// <returns>safe filename</returns> | 542 | /// <returns>safe filename</returns> |
543 | public static string safeFileName(string filename) | 543 | public static string safeFileName(string filename) |
544 | { | 544 | { |
545 | return Regex.Replace(filename, @regexInvalidFileChars, string.Empty); | 545 | return Regex.Replace(filename, regexInvalidFileChars, String.Empty); |
546 | ; | 546 | ; |
547 | } | 547 | } |
548 | 548 | ||
@@ -594,7 +594,7 @@ namespace OpenSim.Framework | |||
594 | { | 594 | { |
595 | FileInfo f = new FileInfo(FileName); | 595 | FileInfo f = new FileInfo(FileName); |
596 | 596 | ||
597 | if (!string.IsNullOrEmpty(f.Extension)) | 597 | if (!String.IsNullOrEmpty(f.Extension)) |
598 | { | 598 | { |
599 | Name = f.FullName.Substring(0, f.FullName.LastIndexOf('.')); | 599 | Name = f.FullName.Substring(0, f.FullName.LastIndexOf('.')); |
600 | } | 600 | } |
@@ -959,7 +959,7 @@ namespace OpenSim.Framework | |||
959 | } | 959 | } |
960 | else if (fieldInfo.FieldType == typeof(System.UInt32)) | 960 | else if (fieldInfo.FieldType == typeof(System.UInt32)) |
961 | { | 961 | { |
962 | fieldInfo.SetValue(settingsClass, System.Convert.ToUInt32(config.Get(fieldInfo.Name, ((uint)fieldInfo.GetValue(settingsClass)).ToString()))); | 962 | fieldInfo.SetValue(settingsClass, Convert.ToUInt32(config.Get(fieldInfo.Name, ((uint)fieldInfo.GetValue(settingsClass)).ToString()))); |
963 | } | 963 | } |
964 | } | 964 | } |
965 | } | 965 | } |
@@ -987,12 +987,25 @@ namespace OpenSim.Framework | |||
987 | } | 987 | } |
988 | if (propInfo.PropertyType == typeof(System.UInt32)) | 988 | if (propInfo.PropertyType == typeof(System.UInt32)) |
989 | { | 989 | { |
990 | propInfo.SetValue(settingsClass, System.Convert.ToUInt32(config.Get(propInfo.Name, ((uint)propInfo.GetValue(settingsClass, null)).ToString())), null); | 990 | propInfo.SetValue(settingsClass, Convert.ToUInt32(config.Get(propInfo.Name, ((uint)propInfo.GetValue(settingsClass, null)).ToString())), null); |
991 | } | 991 | } |
992 | } | 992 | } |
993 | } | 993 | } |
994 | 994 | ||
995 | return settingsClass; | 995 | return settingsClass; |
996 | } | 996 | } |
997 | |||
998 | public static string Base64ToString(string str) | ||
999 | { | ||
1000 | UTF8Encoding encoder = new UTF8Encoding(); | ||
1001 | Decoder utf8Decode = encoder.GetDecoder(); | ||
1002 | |||
1003 | byte[] todecode_byte = Convert.FromBase64String(str); | ||
1004 | int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); | ||
1005 | char[] decoded_char = new char[charCount]; | ||
1006 | utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0); | ||
1007 | string result = new String(decoded_char); | ||
1008 | return result; | ||
1009 | } | ||
997 | } | 1010 | } |
998 | } | 1011 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e32f1b4..b01a4aa 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -6824,16 +6824,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6824 | public LSL_String llBase64ToString(string str) | 6824 | public LSL_String llBase64ToString(string str) |
6825 | { | 6825 | { |
6826 | m_host.AddScriptLPS(1); | 6826 | m_host.AddScriptLPS(1); |
6827 | UTF8Encoding encoder = new UTF8Encoding(); | ||
6828 | Decoder utf8Decode = encoder.GetDecoder(); | ||
6829 | try | 6827 | try |
6830 | { | 6828 | { |
6831 | byte[] todecode_byte = Convert.FromBase64String(str); | 6829 | return Util.Base64ToString(str); |
6832 | int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); | ||
6833 | char[] decoded_char = new char[charCount]; | ||
6834 | utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0); | ||
6835 | string result = new String(decoded_char); | ||
6836 | return result; | ||
6837 | } | 6830 | } |
6838 | catch (Exception e) | 6831 | catch (Exception e) |
6839 | { | 6832 | { |
@@ -6841,6 +6834,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6841 | } | 6834 | } |
6842 | } | 6835 | } |
6843 | 6836 | ||
6837 | |||
6844 | public LSL_String llXorBase64Strings(string str1, string str2) | 6838 | public LSL_String llXorBase64Strings(string str1, string str2) |
6845 | { | 6839 | { |
6846 | m_host.AddScriptLPS(1); | 6840 | m_host.AddScriptLPS(1); |