aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs')
-rw-r--r--OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs43
1 files changed, 43 insertions, 0 deletions
diff --git a/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs b/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs
index ccebb24..f82418d 100644
--- a/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs
+++ b/OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Threading; 30using System.Threading;
31using System.Reflection;
31using libsecondlife; 32using libsecondlife;
32using libsecondlife.Packets; 33using libsecondlife.Packets;
33using OpenSim; 34using OpenSim;
@@ -71,6 +72,20 @@ namespace OpenSim.Assets
71 72
72 } 73 }
73 74
75 public AssetCache(string assetServerDLLName, string assetServerURL, string assetServerKey)
76 {
77 Console.WriteLine("Creating Asset cache");
78 _assetServer = this.LoadAssetDll(assetServerDLLName);
79 _assetServer.SetServerInfo(assetServerURL, assetServerKey);
80 _assetServer.SetReceiver(this);
81 Assets = new Dictionary<libsecondlife.LLUUID, AssetInfo>();
82 Textures = new Dictionary<libsecondlife.LLUUID, TextureImage>();
83 this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
84 this._assetCacheThread.IsBackground = true;
85 this._assetCacheThread.Start();
86
87 }
88
74 /// <summary> 89 /// <summary>
75 /// 90 ///
76 /// </summary> 91 /// </summary>
@@ -513,6 +528,34 @@ namespace OpenSim.Assets
513 } 528 }
514 #endregion 529 #endregion
515 530
531 private IAssetServer LoadAssetDll(string dllName)
532 {
533 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
534 IAssetServer server = null;
535
536 foreach (Type pluginType in pluginAssembly.GetTypes())
537 {
538 if (pluginType.IsPublic)
539 {
540 if (!pluginType.IsAbstract)
541 {
542 Type typeInterface = pluginType.GetInterface("IAssetPlugin", true);
543
544 if (typeInterface != null)
545 {
546 IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
547 server = plug.GetAssetServer();
548 break;
549 }
550
551 typeInterface = null;
552 }
553 }
554 }
555 pluginAssembly = null;
556 return server;
557 }
558
516 } 559 }
517 560
518 public class AssetRequest 561 public class AssetRequest