From 4ae10034bd929c6451633c6fc5172c44e9280fa4 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 28 Dec 2007 22:13:43 +0000 Subject: Factor out common asset loading from AssetServerBase and Grid/AssetServer/Main --- OpenSim/Grid/AssetServer/Main.cs | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) (limited to 'OpenSim/Grid') diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs index 5d3d265..473c0bb 100644 --- a/OpenSim/Grid/AssetServer/Main.cs +++ b/OpenSim/Grid/AssetServer/Main.cs @@ -30,8 +30,8 @@ using System; using System.IO; using System.Reflection; using libsecondlife; -using Nini.Config; using OpenSim.Framework; +using OpenSim.Framework.AssetLoader.Filesystem; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; @@ -45,8 +45,12 @@ namespace OpenSim.Grid.AssetServer public AssetConfig m_config; public static OpenAsset_Main assetserver; - - private LogBase m_console; + + private LogBase m_console; + + // Temporarily hardcoded - should be a plugin + protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); + private IAssetProvider m_assetProvider; [STAThread] @@ -199,29 +203,13 @@ namespace OpenSim.Grid.AssetServer public void LoadDefaultAssets() { - string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml"); - if (File.Exists(filePath)) - { - XmlConfigSource source = new XmlConfigSource(filePath); - - for (int i = 0; i < source.Configs.Count; i++) - { - string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToString()); - string name = source.Configs[i].GetString("name", ""); - sbyte type = (sbyte) source.Configs[i].GetInt("assetType", 0); - sbyte invType = (sbyte) source.Configs[i].GetInt("inventoryType", 0); - string fileName = source.Configs[i].GetString("fileName", ""); - - AssetBase newAsset = CreateAsset(assetIdStr, name, fileName, false); - - newAsset.Type = type; - newAsset.InvType = invType; - - m_assetProvider.CreateAsset(newAsset); - } - } + assetLoader.ForEachXmlAsset(StoreAsset); } + protected void StoreAsset(AssetBase asset) + { + m_assetProvider.CreateAsset(asset); + } public void RunCmd(string cmd, string[] cmdparams) { -- cgit v1.1