diff options
author | Justin Clarke Casey | 2007-12-28 22:13:43 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2007-12-28 22:13:43 +0000 |
commit | 4ae10034bd929c6451633c6fc5172c44e9280fa4 (patch) | |
tree | bf3abf3e79787ddfa72c645e977e126c61273845 /OpenSim/Grid/AssetServer | |
parent | * applied melanie's matnis patch #255. Thanks Melanie. (diff) | |
download | opensim-SC-4ae10034bd929c6451633c6fc5172c44e9280fa4.zip opensim-SC-4ae10034bd929c6451633c6fc5172c44e9280fa4.tar.gz opensim-SC-4ae10034bd929c6451633c6fc5172c44e9280fa4.tar.bz2 opensim-SC-4ae10034bd929c6451633c6fc5172c44e9280fa4.tar.xz |
Factor out common asset loading from AssetServerBase and Grid/AssetServer/Main
Diffstat (limited to 'OpenSim/Grid/AssetServer')
-rw-r--r-- | OpenSim/Grid/AssetServer/Main.cs | 36 |
1 files changed, 12 insertions, 24 deletions
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; | |||
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | using Nini.Config; | ||
34 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.AssetLoader.Filesystem; | ||
35 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
36 | using OpenSim.Framework.Servers; | 36 | using OpenSim.Framework.Servers; |
37 | 37 | ||
@@ -45,8 +45,12 @@ namespace OpenSim.Grid.AssetServer | |||
45 | public AssetConfig m_config; | 45 | public AssetConfig m_config; |
46 | 46 | ||
47 | public static OpenAsset_Main assetserver; | 47 | public static OpenAsset_Main assetserver; |
48 | 48 | ||
49 | private LogBase m_console; | 49 | private LogBase m_console; |
50 | |||
51 | // Temporarily hardcoded - should be a plugin | ||
52 | protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); | ||
53 | |||
50 | private IAssetProvider m_assetProvider; | 54 | private IAssetProvider m_assetProvider; |
51 | 55 | ||
52 | [STAThread] | 56 | [STAThread] |
@@ -199,29 +203,13 @@ namespace OpenSim.Grid.AssetServer | |||
199 | 203 | ||
200 | public void LoadDefaultAssets() | 204 | public void LoadDefaultAssets() |
201 | { | 205 | { |
202 | string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml"); | 206 | assetLoader.ForEachXmlAsset(StoreAsset); |
203 | if (File.Exists(filePath)) | ||
204 | { | ||
205 | XmlConfigSource source = new XmlConfigSource(filePath); | ||
206 | |||
207 | for (int i = 0; i < source.Configs.Count; i++) | ||
208 | { | ||
209 | string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToString()); | ||
210 | string name = source.Configs[i].GetString("name", ""); | ||
211 | sbyte type = (sbyte) source.Configs[i].GetInt("assetType", 0); | ||
212 | sbyte invType = (sbyte) source.Configs[i].GetInt("inventoryType", 0); | ||
213 | string fileName = source.Configs[i].GetString("fileName", ""); | ||
214 | |||
215 | AssetBase newAsset = CreateAsset(assetIdStr, name, fileName, false); | ||
216 | |||
217 | newAsset.Type = type; | ||
218 | newAsset.InvType = invType; | ||
219 | |||
220 | m_assetProvider.CreateAsset(newAsset); | ||
221 | } | ||
222 | } | ||
223 | } | 207 | } |
224 | 208 | ||
209 | protected void StoreAsset(AssetBase asset) | ||
210 | { | ||
211 | m_assetProvider.CreateAsset(asset); | ||
212 | } | ||
225 | 213 | ||
226 | public void RunCmd(string cmd, string[] cmdparams) | 214 | public void RunCmd(string cmd, string[] cmdparams) |
227 | { | 215 | { |