Class SaveTree
Represents a SAVETREE.DAT file.
Namespace: DaggerfallConnect.Save
Assembly: Assembly-CSharp.dll
Syntax
public class SaveTree
Constructors
| Improve this Doc View SourceSaveTree()
Default constructor.
Declaration
public SaveTree()
SaveTree(String, Boolean)
Open constructor.
Declaration
public SaveTree(string saveTreePath, bool readOnly = true)
Parameters
Type | Name | Description |
---|---|---|
String | saveTreePath | Full path to SAVETREE.DAT file. |
Boolean | readOnly | Flag to open file in read-only mode. |
Fields
| Improve this Doc View SourceBuildingRecords
Declaration
public SaveTreeBuildingRecords BuildingRecords
Field Value
Type | Description |
---|---|
Save |
Filename
Declaration
public const string Filename = "SAVETREE.DAT"
Field Value
Type | Description |
---|---|
String |
Header
Declaration
public SaveTreeHeader Header
Field Value
Type | Description |
---|---|
Save |
RecordDictionary
Declaration
public Dictionary<uint, SaveTreeBaseRecord> RecordDictionary
Field Value
Type | Description |
---|---|
Dictionary<UInt32, Save |
RootRecord
Declaration
public SaveTreeBaseRecord RootRecord
Field Value
Type | Description |
---|---|
Save |
Methods
| Improve this Doc View SourceFilterRecordsByParentType(List<SaveTreeBaseRecord>, RecordTypes)
Filters a record list by parent type.
Declaration
public List<SaveTreeBaseRecord> FilterRecordsByParentType(List<SaveTreeBaseRecord> source, RecordTypes parentType)
Parameters
Type | Name | Description |
---|---|---|
List<Save |
source | Source list. |
Record |
parentType | Parent type to filter for. |
Returns
Type | Description |
---|---|
List<Save |
New list of items with specific parent type. |
FindRecord(RecordTypes, SaveTreeBaseRecord)
Finds first record of type in tree starting from root record.
Declaration
public SaveTreeBaseRecord FindRecord(RecordTypes type, SaveTreeBaseRecord root = null)
Parameters
Type | Name | Description |
---|---|---|
Record |
type | Type of record to search for. |
Save |
root | Root record to start searching from. If null, will start from RecordRoot. |
Returns
Type | Description |
---|---|
Save |
Found item or null if not found. |
FindRecords(RecordTypes, SaveTreeBaseRecord)
Finds all instances of a specific record type in tree starting from root record.
Declaration
public List<SaveTreeBaseRecord> FindRecords(RecordTypes type, SaveTreeBaseRecord root = null)
Parameters
Type | Name | Description |
---|---|---|
Record |
type | Type of record to search for. |
Save |
root | Root record to start searching from. If null, will start from RecordRoot. |
Returns
Type | Description |
---|---|
List<Save |
List of records found. May contain 0 records. |
Open(String, Boolean)
Opens a SAVETREE.DAT file. Always uses FileUsage.UseDisk so possible to write back to original file.
Declaration
public bool Open(string saveTreePath, bool readOnly = true)
Parameters
Type | Name | Description |
---|---|---|
String | saveTreePath | Full path to SAVETREE.DAT file. |
Boolean | readOnly | Flag to open file in read-only mode. |
Returns
Type | Description |
---|---|
Boolean |
PeekRecordType(BinaryReader)
Peeks record type from beginning of RecordRoot without moving stream position.
Declaration
public static RecordTypes PeekRecordType(BinaryReader reader)
Parameters
Type | Name | Description |
---|---|---|
Binary |
reader | Reader positioned at start of RecordRoot data. |
Returns
Type | Description |
---|---|
Record |
Record type. |
ReadPosition(BinaryReader)
Read RecordPosition data from binary stream.
Declaration
public static RecordPosition ReadPosition(BinaryReader reader)
Parameters
Type | Name | Description |
---|---|---|
Binary |
reader | BinaryReader positioned at start of Position data. |
Returns
Type | Description |
---|---|
Record |
RecordPosition struct. |
Save()
Saves changes to SAVETREE.DAT file. Must have been opened with readOnly=false.
Declaration
public void Save()
WritePosition(BinaryWriter, RecordPosition)
Write Position data to a binary stream.
Declaration
public static void WritePosition(BinaryWriter writer, RecordPosition position)
Parameters
Type | Name | Description |
---|---|---|
Binary |
writer | BinaryWriter positioned at start of Position data. |
Record |
position | RecordPosition data to write. |