68 lines
1.7 KiB
C#
68 lines
1.7 KiB
C#
using LibXom.Data;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace LibW4M.Data
|
|
{
|
|
public abstract class SaveDataEntry
|
|
{
|
|
private Guid guid = Guid.NewGuid();
|
|
internal W4SaveFile fileBelongs;
|
|
internal XomContainer mainContainer;
|
|
internal int containerId
|
|
{
|
|
get
|
|
{
|
|
return mainContainer.Id;
|
|
}
|
|
}
|
|
public string Uuid
|
|
{
|
|
get
|
|
{
|
|
return guid.ToString();
|
|
}
|
|
}
|
|
public virtual string FriendlyName
|
|
{ get
|
|
{
|
|
return this.mainContainer.Type.Name;
|
|
}
|
|
}
|
|
public override int GetHashCode()
|
|
{
|
|
return this.Uuid.GetHashCode();
|
|
}
|
|
public override bool Equals(object? obj)
|
|
{
|
|
if (obj is not SaveDataEntry) return false;
|
|
return this.Uuid.Equals((obj as SaveDataEntry).Uuid, StringComparison.InvariantCultureIgnoreCase);
|
|
}
|
|
|
|
public abstract void Load();
|
|
public abstract void Save();
|
|
|
|
internal virtual void loadDefaults()
|
|
{
|
|
//this.Save();
|
|
}
|
|
public virtual void DeleteEntries()
|
|
{
|
|
this.mainContainer.Delete();
|
|
}
|
|
internal SaveDataEntry (W4SaveFile fileBelongs, XomContainer mainContainer, bool load=true)
|
|
{
|
|
this.fileBelongs = fileBelongs;
|
|
this.mainContainer = mainContainer;
|
|
|
|
if (load)
|
|
this.Load();
|
|
else
|
|
this.loadDefaults();
|
|
}
|
|
}
|
|
}
|