aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Util.cs16
-rw-r--r--OpenSim/Services/AssetService/AssetService.cs15
2 files changed, 25 insertions, 6 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 039b926..fce8999 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -440,20 +440,30 @@ namespace OpenSim.Framework
440 } 440 }
441 441
442 /// <summary> 442 /// <summary>
443 /// Return an SHA1 hash of the given string 443 /// Return an SHA1 hash
444 /// </summary> 444 /// </summary>
445 /// <param name="data"></param> 445 /// <param name="data"></param>
446 /// <returns></returns> 446 /// <returns></returns>
447 public static string SHA1Hash(string data) 447 public static string SHA1Hash(string data)
448 { 448 {
449 return SHA1Hash(Encoding.Default.GetBytes(data));
450 }
451
452 /// <summary>
453 /// Return an SHA1 hash
454 /// </summary>
455 /// <param name="data"></param>
456 /// <returns></returns>
457 public static string SHA1Hash(byte[] data)
458 {
449 byte[] hash = ComputeSHA1Hash(data); 459 byte[] hash = ComputeSHA1Hash(data);
450 return BitConverter.ToString(hash).Replace("-", String.Empty); 460 return BitConverter.ToString(hash).Replace("-", String.Empty);
451 } 461 }
452 462
453 private static byte[] ComputeSHA1Hash(string src) 463 private static byte[] ComputeSHA1Hash(byte[] src)
454 { 464 {
455 SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider(); 465 SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider();
456 return SHA1.ComputeHash(Encoding.Default.GetBytes(src)); 466 return SHA1.ComputeHash(src);
457 } 467 }
458 468
459 public static int fast_distance2d(int x, int y) 469 public static int fast_distance2d(int x, int y)
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs
index 851b7b4..c7a259d 100644
--- a/OpenSim/Services/AssetService/AssetService.cs
+++ b/OpenSim/Services/AssetService/AssetService.cs
@@ -84,11 +84,20 @@ namespace OpenSim.Services.AssetService
84 if (assetLoaderEnabled) 84 if (assetLoaderEnabled)
85 { 85 {
86 m_log.InfoFormat("[ASSET]: Loading default asset set from {0}", loaderArgs); 86 m_log.InfoFormat("[ASSET]: Loading default asset set from {0}", loaderArgs);
87 m_AssetLoader.ForEachDefaultXmlAsset(loaderArgs, 87
88 delegate(AssetBase a) 88 m_AssetLoader.ForEachDefaultXmlAsset(
89 loaderArgs,
90 delegate(AssetBase a)
91 {
92 AssetBase existingAsset = Get(a.ID);
93// AssetMetadata existingMetadata = GetMetadata(a.ID);
94
95 if (existingAsset == null || Util.SHA1Hash(existingAsset.Data) != Util.SHA1Hash(a.Data))
89 { 96 {
97// m_log.DebugFormat("[ASSET]: Storing {0} {1}", a.Name, a.ID);
90 Store(a); 98 Store(a);
91 }); 99 }
100 });
92 } 101 }
93 102
94 m_log.Info("[ASSET SERVICE]: Local asset service enabled"); 103 m_log.Info("[ASSET SERVICE]: Local asset service enabled");