protected void ForEachDefaultXmlAsset(string assetSetFilename, Action<AssetBase> action)
{
List<AssetBase> assets = new List<AssetBase>();
if (File.Exists(assetSetFilename))
{
string assetSetPath = "ERROR";
string assetRootPath = "";
try
{
DateTime start = DateTime.Now;
XmlConfigSource source = new XmlConfigSource(assetSetFilename);
assetRootPath = Path.GetFullPath(source.SavePath);
assetRootPath = Path.GetDirectoryName(assetRootPath);
for (int i = 0; i < source.Configs.Count; i++)
{
assetSetPath = source.Configs[i].GetString("file", String.Empty);
LoadXmlAssetSet(Path.Combine(assetRootPath, assetSetPath), assets);
}
MainConsole.Instance.Warn((DateTime.Now - start).Milliseconds);
}
catch (XmlException e)
{
MainConsole.Instance.ErrorFormat("[ASSETS]: Error loading {0} : {1}", assetSetPath, e);
}
}
else
{
MainConsole.Instance.ErrorFormat("[ASSETS]: Asset set control file {0} does not exist! No assets loaded.", assetSetFilename);
}
DateTime start2 = DateTime.Now;
assets.ForEach(action);
MainConsole.Instance.Warn((DateTime.Now - start2).Milliseconds);
}