* 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)
|
||||||
{
|
{
|
||||||
List<AssetBase> assets = new List<AssetBase>();
|
string assetSetFilename = Path.Combine(Util.assetsDir(), "AssetSets.xml");
|
||||||
string assetSetsPath = Path.Combine(Util.assetsDir(), "AssetSets.xml");
|
|
||||||
|
ForEachDefaultXmlAsset(assetSetFilename, action);
|
||||||
if (File.Exists(assetSetsPath))
|
}
|
||||||
|
|
||||||
|
public void ForEachDefaultXmlAsset(string assetSetFilename, Action<AssetBase> action)
|
||||||
|
{
|
||||||
|
List<AssetBase> assets = new List<AssetBase>();
|
||||||
|
if (File.Exists(assetSetFilename))
|
||||||
{
|
{
|
||||||
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++)
|
||||||
{
|
{
|
||||||
|
@ -111,9 +116,9 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
|
||||||
"Asset set control file assets/AssetSets.xml does not exist! No assets loaded.");
|
"Asset set control file assets/AssetSets.xml does not exist! No assets loaded.");
|
||||||
}
|
}
|
||||||
|
|
||||||
assets.ForEach(action);
|
assets.ForEach(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Use the asset set information at path to load assets
|
/// Use the asset set information at path to load assets
|
||||||
/// </summary>
|
/// </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");
|
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