mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 18:25:33 +08:00
Should allow multiple worlds (and UDP servers) to be ran in one instance, just missing backend comms and working Avatar/primitives classes.
This commit is contained in:
@@ -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<libsecondlife.LLUUID, AssetInfo>();
|
||||
Textures = new Dictionary<libsecondlife.LLUUID, TextureImage>();
|
||||
this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
|
||||
this._assetCacheThread.IsBackground = true;
|
||||
this._assetCacheThread.Start();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user