aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Data/MySQL/MySQLSuperManager.cs48
-rw-r--r--OpenSim/Framework/Communications/Cache/FileAssetClient.cs112
2 files changed, 80 insertions, 80 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSuperManager.cs b/OpenSim/Data/MySQL/MySQLSuperManager.cs
index 4a9c7fa..b2485b1 100644
--- a/OpenSim/Data/MySQL/MySQLSuperManager.cs
+++ b/OpenSim/Data/MySQL/MySQLSuperManager.cs
@@ -1,24 +1,24 @@
1using System.Threading; 1using System.Threading;
2 2
3namespace OpenSim.Data.MySQL 3namespace OpenSim.Data.MySQL
4{ 4{
5 public class MySQLSuperManager 5 public class MySQLSuperManager
6 { 6 {
7 public bool Locked; 7 public bool Locked;
8 private readonly Mutex m_lock = new Mutex(false); 8 private readonly Mutex m_lock = new Mutex(false);
9 public MySQLManager Manager; 9 public MySQLManager Manager;
10 10
11 public void GetLock() 11 public void GetLock()
12 { 12 {
13 Locked = true; 13 Locked = true;
14 m_lock.WaitOne(); 14 m_lock.WaitOne();
15 } 15 }
16 16
17 public void Release() 17 public void Release()
18 { 18 {
19 m_lock.ReleaseMutex(); 19 m_lock.ReleaseMutex();
20 Locked = false; 20 Locked = false;
21 } 21 }
22 22
23 } 23 }
24} 24}
diff --git a/OpenSim/Framework/Communications/Cache/FileAssetClient.cs b/OpenSim/Framework/Communications/Cache/FileAssetClient.cs
index fcab349..3c74d4d 100644
--- a/OpenSim/Framework/Communications/Cache/FileAssetClient.cs
+++ b/OpenSim/Framework/Communications/Cache/FileAssetClient.cs
@@ -1,56 +1,56 @@
1using System.IO; 1using System.IO;
2using System.Xml.Serialization; 2using System.Xml.Serialization;
3 3
4namespace OpenSim.Framework.Communications.Cache 4namespace OpenSim.Framework.Communications.Cache
5{ 5{
6 public class FileAssetClient : AssetServerBase 6 public class FileAssetClient : AssetServerBase
7 { 7 {
8 private readonly string m_dir; 8 private readonly string m_dir;
9 private readonly XmlSerializer m_xs = new XmlSerializer(typeof(AssetBase)); 9 private readonly XmlSerializer m_xs = new XmlSerializer(typeof(AssetBase));
10 10
11 public FileAssetClient(string dir) 11 public FileAssetClient(string dir)
12 { 12 {
13 if(!Directory.Exists(dir)) 13 if(!Directory.Exists(dir))
14 { 14 {
15 Directory.CreateDirectory(dir); 15 Directory.CreateDirectory(dir);
16 } 16 }
17 m_dir = dir; 17 m_dir = dir;
18 } 18 }
19 public override void StoreAsset(AssetBase asset) 19 public override void StoreAsset(AssetBase asset)
20 { 20 {
21 string cdir = m_dir + Path.DirectorySeparatorChar + asset.FullID.Data[0] 21 string cdir = m_dir + Path.DirectorySeparatorChar + asset.FullID.Data[0]
22 + Path.DirectorySeparatorChar + asset.FullID.Data[1]; 22 + Path.DirectorySeparatorChar + asset.FullID.Data[1];
23 23
24 if (!Directory.Exists(m_dir + Path.DirectorySeparatorChar + asset.FullID.Data[0])) 24 if (!Directory.Exists(m_dir + Path.DirectorySeparatorChar + asset.FullID.Data[0]))
25 Directory.CreateDirectory(m_dir + Path.DirectorySeparatorChar + asset.FullID.Data[0]); 25 Directory.CreateDirectory(m_dir + Path.DirectorySeparatorChar + asset.FullID.Data[0]);
26 26
27 if (!Directory.Exists(cdir)) 27 if (!Directory.Exists(cdir))
28 Directory.CreateDirectory(cdir); 28 Directory.CreateDirectory(cdir);
29 29
30 FileStream x = new FileStream(cdir + Path.DirectorySeparatorChar + asset.FullID + ".xml", FileMode.Create); 30 FileStream x = new FileStream(cdir + Path.DirectorySeparatorChar + asset.FullID + ".xml", FileMode.Create);
31 m_xs.Serialize(x, asset); 31 m_xs.Serialize(x, asset);
32 32
33 x.Flush(); 33 x.Flush();
34 x.Close(); 34 x.Close();
35 } 35 }
36 36
37 public override void UpdateAsset(AssetBase asset) 37 public override void UpdateAsset(AssetBase asset)
38 { 38 {
39 StoreAsset(asset); 39 StoreAsset(asset);
40 } 40 }
41 41
42 protected override AssetBase GetAsset(AssetRequest req) 42 protected override AssetBase GetAsset(AssetRequest req)
43 { 43 {
44 string cdir = m_dir + Path.DirectorySeparatorChar + req.AssetID.Data[0] 44 string cdir = m_dir + Path.DirectorySeparatorChar + req.AssetID.Data[0]
45 + Path.DirectorySeparatorChar + req.AssetID.Data[1]; 45 + Path.DirectorySeparatorChar + req.AssetID.Data[1];
46 if (File.Exists(cdir + Path.DirectorySeparatorChar + req.AssetID + ".xml")) 46 if (File.Exists(cdir + Path.DirectorySeparatorChar + req.AssetID + ".xml"))
47 { 47 {
48 FileStream x = File.OpenRead(cdir + Path.DirectorySeparatorChar + req.AssetID + ".xml"); 48 FileStream x = File.OpenRead(cdir + Path.DirectorySeparatorChar + req.AssetID + ".xml");
49 AssetBase ret = (AssetBase) m_xs.Deserialize(x); 49 AssetBase ret = (AssetBase) m_xs.Deserialize(x);
50 x.Close(); 50 x.Close();
51 return ret; 51 return ret;
52 } 52 }
53 return null; 53 return null;
54 } 54 }
55 } 55 }
56} 56}