* 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;
|
//info.loaded=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ForEachXmlAsset(Action<AssetBase> action)
|
public void ForEachDefaultXmlAsset(Action<AssetBase> action)
|
||||||
|
{
|
||||||
|
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>();
|
List<AssetBase> assets = new List<AssetBase>();
|
||||||
string assetSetsPath = Path.Combine(Util.assetsDir(), "AssetSets.xml");
|
if (File.Exists(assetSetFilename))
|
||||||
|
|
||||||
if (File.Exists(assetSetsPath))
|
|
||||||
{
|
{
|
||||||
string assetSetPath = "ERROR";
|
string assetSetPath = "ERROR";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
XmlConfigSource source = new XmlConfigSource(assetSetsPath);
|
XmlConfigSource source = new XmlConfigSource(assetSetFilename);
|
||||||
|
|
||||||
for (int i = 0; i < source.Configs.Count; i++)
|
for (int i = 0; i < source.Configs.Count; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,11 +82,11 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadDefaultAssets()
|
public virtual void LoadDefaultAssets()
|
||||||
{
|
{
|
||||||
MainLog.Instance.Verbose("ASSETSERVER", "Setting up asset database");
|
MainLog.Instance.Verbose("ASSETSERVER", "Setting up asset database");
|
||||||
|
|
||||||
assetLoader.ForEachXmlAsset(StoreAsset);
|
assetLoader.ForEachDefaultXmlAsset(StoreAsset);
|
||||||
|
|
||||||
CommitAssets();
|
CommitAssets();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
public interface IAssetLoader
|
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()
|
public void LoadDefaultAssets()
|
||||||
{
|
{
|
||||||
assetLoader.ForEachXmlAsset(StoreAsset);
|
assetLoader.ForEachDefaultXmlAsset(StoreAsset);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void StoreAsset(AssetBase asset)
|
protected void StoreAsset(AssetBase asset)
|
||||||
|
|
Loading…
Reference in New Issue