Worms4Editor/LibW4M/W4SaveFile.cs

41 lines
1.1 KiB
C#

using LibW4M.Data;
using LibW4M.Data.WeaponFactory;
using LibXom;
using LibXom.Data;
namespace LibW4M
{
public class W4SaveFile
{
internal List<SaveDataEntry> entries = new List<SaveDataEntry>();
private WeaponsCollective weaponFactoryCollective;
public WeaponsCollective WeaponFactoryCollective
{
get
{
return weaponFactoryCollective;
}
}
internal XomFile xomFile;
public void Save(string newXom)
{
foreach(SaveDataEntry entry in entries)
{
entry.Save();
}
XomWriter.WriteXom(xomFile, newXom);
}
public XomString LookupString(string value)
{
return xomFile.AddOrGetString(value);
}
public W4SaveFile(XomFile w4Save)
{
this.xomFile = w4Save;
weaponFactoryCollective = new WeaponsCollective(this, this.xomFile.GetTypeByName("WeaponFactoryCollective").Containers.First());
entries.Add(weaponFactoryCollective);
}
}
}