protected void LoadXmlAssetSet(string assetSetPath, List<AssetBase> assets)
{
//MainConsole.Instance.InfoFormat("[ASSETS]: Loading asset set {0}", assetSetPath);
if (File.Exists(assetSetPath))
{
try
{
XmlConfigSource source = new XmlConfigSource(assetSetPath);
String dir = Path.GetDirectoryName(assetSetPath);
for (int i = 0; i < source.Configs.Count; i++)
{
string assetIdStr = source.Configs[i].GetString("assetID", UUID.Random().ToString());
string name = source.Configs[i].GetString("name", String.Empty);
AssetType type = (AssetType)source.Configs[i].GetInt("assetType", 0);
string assetPath = Path.Combine(dir, source.Configs[i].GetString("fileName", String.Empty));
AssetBase newAsset = CreateAsset(assetIdStr, name, assetPath, type);
newAsset.Type = (int)type;
assets.Add(newAsset);
}
}
catch (XmlException e)
{
MainConsole.Instance.ErrorFormat("[ASSETS]: Error loading {0} : {1}", assetSetPath, e);
}
}
else
{
MainConsole.Instance.ErrorFormat("[ASSETS]: Asset set file {0} does not exist!", assetSetPath);
}
}