diff options
author | lbsa71 | 2008-01-02 07:13:34 +0000 |
---|---|---|
committer | lbsa71 | 2008-01-02 07:13:34 +0000 |
commit | 20653830fbd0c0104a62e9c1b71744284b77b754 (patch) | |
tree | 0212d34f7a9802a71ea3ea3ba6404e50de8d00a3 | |
parent | * Added using as per mail to see if that does anything for Ursulas build issu... (diff) | |
download | opensim-SC_OLD-20653830fbd0c0104a62e9c1b71744284b77b754.zip opensim-SC_OLD-20653830fbd0c0104a62e9c1b71744284b77b754.tar.gz opensim-SC_OLD-20653830fbd0c0104a62e9c1b71744284b77b754.tar.bz2 opensim-SC_OLD-20653830fbd0c0104a62e9c1b71744284b77b754.tar.xz |
* Refactored out function to load specified AssetSet Xml
This commit dedicated to 'Mohawk - Bad Girls (Need Love Too)'
-rw-r--r-- | OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs | 21 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetServerBase.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/IAssetLoader.cs | 3 | ||||
-rw-r--r-- | OpenSim/Grid/AssetServer/Main.cs | 2 |
4 files changed, 18 insertions, 12 deletions
diff --git a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs index 46e6ae1..d6ce0c5 100644 --- a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs +++ b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs | |||
@@ -79,18 +79,23 @@ namespace OpenSim.Framework.AssetLoader.Filesystem | |||
79 | //info.loaded=true; | 79 | //info.loaded=true; |
80 | } | 80 | } |
81 | 81 | ||
82 | public void ForEachXmlAsset(Action<AssetBase> action) | 82 | public void ForEachDefaultXmlAsset(Action<AssetBase> action) |
83 | { | 83 | { |
84 | List<AssetBase> assets = new List<AssetBase>(); | 84 | string assetSetFilename = Path.Combine(Util.assetsDir(), "AssetSets.xml"); |
85 | string assetSetsPath = Path.Combine(Util.assetsDir(), "AssetSets.xml"); | 85 | |
86 | 86 | ForEachDefaultXmlAsset(assetSetFilename, action); | |
87 | if (File.Exists(assetSetsPath)) | 87 | } |
88 | |||
89 | public void ForEachDefaultXmlAsset(string assetSetFilename, Action<AssetBase> action) | ||
90 | { | ||
91 | List<AssetBase> assets = new List<AssetBase>(); | ||
92 | if (File.Exists(assetSetFilename)) | ||
88 | { | 93 | { |
89 | string assetSetPath = "ERROR"; | 94 | string assetSetPath = "ERROR"; |
90 | 95 | ||
91 | try | 96 | try |
92 | { | 97 | { |
93 | XmlConfigSource source = new XmlConfigSource(assetSetsPath); | 98 | XmlConfigSource source = new XmlConfigSource(assetSetFilename); |
94 | 99 | ||
95 | for (int i = 0; i < source.Configs.Count; i++) | 100 | for (int i = 0; i < source.Configs.Count; i++) |
96 | { | 101 | { |
@@ -111,9 +116,9 @@ namespace OpenSim.Framework.AssetLoader.Filesystem | |||
111 | "Asset set control file assets/AssetSets.xml does not exist! No assets loaded."); | 116 | "Asset set control file assets/AssetSets.xml does not exist! No assets loaded."); |
112 | } | 117 | } |
113 | 118 | ||
114 | assets.ForEach(action); | 119 | assets.ForEach(action); |
115 | } | 120 | } |
116 | 121 | ||
117 | /// <summary> | 122 | /// <summary> |
118 | /// Use the asset set information at path to load assets | 123 | /// Use the asset set information at path to load assets |
119 | /// </summary> | 124 | /// </summary> |
diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs index 2153fbf..318082b 100644 --- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs | |||
@@ -82,11 +82,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | public void LoadDefaultAssets() | 85 | public virtual void LoadDefaultAssets() |
86 | { | 86 | { |
87 | MainLog.Instance.Verbose("ASSETSERVER", "Setting up asset database"); | 87 | MainLog.Instance.Verbose("ASSETSERVER", "Setting up asset database"); |
88 | 88 | ||
89 | assetLoader.ForEachXmlAsset(StoreAsset); | 89 | assetLoader.ForEachDefaultXmlAsset(StoreAsset); |
90 | 90 | ||
91 | CommitAssets(); | 91 | CommitAssets(); |
92 | } | 92 | } |
diff --git a/OpenSim/Framework/IAssetLoader.cs b/OpenSim/Framework/IAssetLoader.cs index 6bcaa24..df0b81b 100644 --- a/OpenSim/Framework/IAssetLoader.cs +++ b/OpenSim/Framework/IAssetLoader.cs | |||
@@ -32,6 +32,7 @@ namespace OpenSim.Framework | |||
32 | { | 32 | { |
33 | public interface IAssetLoader | 33 | public interface IAssetLoader |
34 | { | 34 | { |
35 | void ForEachXmlAsset(Action<AssetBase> action); | 35 | void ForEachDefaultXmlAsset(Action<AssetBase> action); |
36 | void ForEachDefaultXmlAsset(string assetSetFilename, Action<AssetBase> action); | ||
36 | } | 37 | } |
37 | } | 38 | } |
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs index 01b2c02..ed77e3e 100644 --- a/OpenSim/Grid/AssetServer/Main.cs +++ b/OpenSim/Grid/AssetServer/Main.cs | |||
@@ -159,7 +159,7 @@ namespace OpenSim.Grid.AssetServer | |||
159 | 159 | ||
160 | public void LoadDefaultAssets() | 160 | public void LoadDefaultAssets() |
161 | { | 161 | { |
162 | assetLoader.ForEachXmlAsset(StoreAsset); | 162 | assetLoader.ForEachDefaultXmlAsset(StoreAsset); |
163 | } | 163 | } |
164 | 164 | ||
165 | protected void StoreAsset(AssetBase asset) | 165 | protected void StoreAsset(AssetBase asset) |