* Refactored out function to load specified AssetSet Xml
This commit dedicated to 'Mohawk - Bad Girls (Need Love Too)'afrisby
parent
7909d80821
commit
20653830fb
|
@ -79,18 +79,23 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
|
|||
//info.loaded=true;
|
||||
}
|
||||
|
||||
public void ForEachXmlAsset(Action<AssetBase> action)
|
||||
public void ForEachDefaultXmlAsset(Action<AssetBase> action)
|
||||
{
|
||||
List<AssetBase> assets = new List<AssetBase>();
|
||||
string assetSetsPath = Path.Combine(Util.assetsDir(), "AssetSets.xml");
|
||||
|
||||
if (File.Exists(assetSetsPath))
|
||||
string assetSetFilename = Path.Combine(Util.assetsDir(), "AssetSets.xml");
|
||||
|
||||
ForEachDefaultXmlAsset(assetSetFilename, action);
|
||||
}
|
||||
|
||||
public void ForEachDefaultXmlAsset(string assetSetFilename, Action<AssetBase> action)
|
||||
{
|
||||
List<AssetBase> assets = new List<AssetBase>();
|
||||
if (File.Exists(assetSetFilename))
|
||||
{
|
||||
string assetSetPath = "ERROR";
|
||||
|
||||
try
|
||||
{
|
||||
XmlConfigSource source = new XmlConfigSource(assetSetsPath);
|
||||
XmlConfigSource source = new XmlConfigSource(assetSetFilename);
|
||||
|
||||
for (int i = 0; i < source.Configs.Count; i++)
|
||||
{
|
||||
|
@ -111,9 +116,9 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
|
|||
"Asset set control file assets/AssetSets.xml does not exist! No assets loaded.");
|
||||
}
|
||||
|
||||
assets.ForEach(action);
|
||||
assets.ForEach(action);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Use the asset set information at path to load assets
|
||||
/// </summary>
|
||||
|
|
|
@ -82,11 +82,11 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
}
|
||||
}
|
||||
|
||||
public void LoadDefaultAssets()
|
||||
public virtual void LoadDefaultAssets()
|
||||
{
|
||||
MainLog.Instance.Verbose("ASSETSERVER", "Setting up asset database");
|
||||
|
||||
assetLoader.ForEachXmlAsset(StoreAsset);
|
||||
assetLoader.ForEachDefaultXmlAsset(StoreAsset);
|
||||
|
||||
CommitAssets();
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace OpenSim.Framework
|
|||
{
|
||||
public interface IAssetLoader
|
||||
{
|
||||
void ForEachXmlAsset(Action<AssetBase> action);
|
||||
void ForEachDefaultXmlAsset(Action<AssetBase> action);
|
||||
void ForEachDefaultXmlAsset(string assetSetFilename, Action<AssetBase> action);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ namespace OpenSim.Grid.AssetServer
|
|||
|
||||
public void LoadDefaultAssets()
|
||||
{
|
||||
assetLoader.ForEachXmlAsset(StoreAsset);
|
||||
assetLoader.ForEachDefaultXmlAsset(StoreAsset);
|
||||
}
|
||||
|
||||
protected void StoreAsset(AssetBase asset)
|
||||
|
|
Loading…
Reference in New Issue