From c746a2f9f4f0b1e7eea564effdae63472f79ab22 Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 27 May 2007 18:52:42 +0000 Subject: Should allow multiple worlds (and UDP servers) to be ran in one instance, just missing backend comms and working Avatar/primitives classes. --- OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs | 43 +++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'OpenSim/OpenSim.RegionServer/Assets/AssetCache.cs') 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 @@ using System; using System.Collections.Generic; using System.Threading; +using System.Reflection; using libsecondlife; using libsecondlife.Packets; using OpenSim; @@ -71,6 +72,20 @@ namespace OpenSim.Assets } + public AssetCache(string assetServerDLLName, string assetServerURL, string assetServerKey) + { + Console.WriteLine("Creating Asset cache"); + _assetServer = this.LoadAssetDll(assetServerDLLName); + _assetServer.SetServerInfo(assetServerURL, assetServerKey); + _assetServer.SetReceiver(this); + Assets = new Dictionary(); + Textures = new Dictionary(); + this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); + this._assetCacheThread.IsBackground = true; + this._assetCacheThread.Start(); + + } + /// /// /// @@ -513,6 +528,34 @@ namespace OpenSim.Assets } #endregion + private IAssetServer LoadAssetDll(string dllName) + { + Assembly pluginAssembly = Assembly.LoadFrom(dllName); + IAssetServer server = null; + + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (pluginType.IsPublic) + { + if (!pluginType.IsAbstract) + { + Type typeInterface = pluginType.GetInterface("IAssetPlugin", true); + + if (typeInterface != null) + { + IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + server = plug.GetAssetServer(); + break; + } + + typeInterface = null; + } + } + } + pluginAssembly = null; + return server; + } + } public class AssetRequest -- cgit v1.1