C# Class TagTool.Cache.TagCache

Provides methods for easily editing tags.dat files.
ファイルを表示 Open project: TheGuardians/TagTool Class Usage Examples

Public Methods

Method Description
AllocateTag ( ) : TagInstance

Allocates a new tag at the end of the tag list without updating the file. The tag's group will be null until it is assigned data. You can give the tag data by using one of the overwrite functions.

AllocateTag ( TagGroup type ) : TagInstance

Allocates a new tag at the end of the tag list without updating the file. You can give the tag data by using one of the overwrite functions.

DuplicateTag ( Stream stream, TagInstance tag ) : TagInstance

Duplicates a tag.

ExtractTag ( Stream stream, TagInstance tag ) : TagData

Reads a tag's data from the file.

ExtractTagRaw ( Stream stream, TagInstance tag ) : byte[]

Reads a tag's raw data from the file, including its header.

SetTagData ( Stream stream, TagInstance tag, TagData data ) : void

Overwrites a tag's data.

SetTagDataRaw ( Stream stream, TagInstance tag, byte data ) : void

Overwrites a tag's raw data, including its header.

TagCache ( Stream stream ) : System

Opens a tags.dat file from a stream.

UpdateTagOffsets ( BinaryWriter writer ) : void

Updates the tag offset table in the file.

Private Methods

Method Description
BuildTagDescription ( Stream stream, TagInstance tag, uint &dataOffset ) : TagData

Builds a description for a tag's data without extracting anything.

FixTagOffsets ( long startOffset, long sizeDelta, TagInstance ignore ) : void

Fixes tag offsets after a resize operation.

GetNewTagOffset ( int index ) : long

Gets the offset that a new tag should be inserted at so that the tags are stored in order by index.

GetTagDataEndOffset ( ) : long

Gets the tag data end offset.

Load ( BinaryReader reader ) : void

Reads the tags.dat file.

ResizeBlock ( Stream stream, TagInstance tag, long startOffset, long oldSize, long newSize ) : void

Resizes a block of data in the file.

UpdateFileHeader ( BinaryWriter writer, long offsetTableOffset ) : void

Updates the file header.

Method Details

AllocateTag() public method

Allocates a new tag at the end of the tag list without updating the file. The tag's group will be null until it is assigned data. You can give the tag data by using one of the overwrite functions.
public AllocateTag ( ) : TagInstance
return TagTool.TagGroups.TagInstance

AllocateTag() public method

Allocates a new tag at the end of the tag list without updating the file. You can give the tag data by using one of the overwrite functions.
public AllocateTag ( TagGroup type ) : TagInstance
type TagGroup The tag's type information.
return TagTool.TagGroups.TagInstance

DuplicateTag() public method

Duplicates a tag.
public DuplicateTag ( Stream stream, TagInstance tag ) : TagInstance
stream Stream The stream to write to.
tag TagTool.TagGroups.TagInstance The tag to duplicate.
return TagTool.TagGroups.TagInstance

ExtractTag() public method

Reads a tag's data from the file.
public ExtractTag ( Stream stream, TagInstance tag ) : TagData
stream Stream The stream to read from.
tag TagTool.TagGroups.TagInstance The tag to read.
return TagData

ExtractTagRaw() public method

Reads a tag's raw data from the file, including its header.
public ExtractTagRaw ( Stream stream, TagInstance tag ) : byte[]
stream Stream The stream to read from.
tag TagTool.TagGroups.TagInstance The tag to read.
return byte[]

SetTagData() public method

Overwrites a tag's data.
public SetTagData ( Stream stream, TagInstance tag, TagData data ) : void
stream Stream The stream to write to.
tag TagTool.TagGroups.TagInstance The tag to overwrite.
data TagData The data to store.
return void

SetTagDataRaw() public method

Overwrites a tag's raw data, including its header.
tag
public SetTagDataRaw ( Stream stream, TagInstance tag, byte data ) : void
stream Stream The stream to write to.
tag TagTool.TagGroups.TagInstance The tag to overwrite.
data byte The data to overwrite the tag with.
return void

TagCache() public method

Opens a tags.dat file from a stream.
public TagCache ( Stream stream ) : System
stream Stream The stream to open.
return System

UpdateTagOffsets() public method

Updates the tag offset table in the file.
public UpdateTagOffsets ( BinaryWriter writer ) : void
writer System.IO.BinaryWriter The stream to write to.
return void