本文整理汇总了C#中IWriter.SeekTo方法的典型用法代码示例。如果您正苦于以下问题:C# IWriter.SeekTo方法的具体用法?C# IWriter.SeekTo怎么用?C# IWriter.SeekTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWriter
的用法示例。
在下文中一共展示了IWriter.SeekTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteLocaleChanges
private static void WriteLocaleChanges(Patch patch, IWriter writer)
{
if (patch.LanguageChanges.Count == 0)
return;
long startPos = writer.Position;
writer.WriteInt32(AssemblyPatchBlockID.Locl);
writer.WriteUInt32(0); // Size filled in later
writer.WriteByte(0); // Version 0
// Write change data for each language
writer.WriteByte((byte)patch.LanguageChanges.Count);
foreach (LanguageChange language in patch.LanguageChanges)
{
writer.WriteByte(language.LanguageIndex);
// Write the change data for each string in the language
writer.WriteInt32(language.LocaleChanges.Count);
foreach (LocaleChange change in language.LocaleChanges)
{
writer.WriteUInt16((ushort)change.Index);
writer.WriteUTF8(change.NewValue);
}
}
// Fill in the block size
long endPos = writer.Position;
writer.SeekTo(startPos + 4);
writer.WriteUInt32((uint)(endPos - startPos));
writer.SeekTo(endPos);
}
示例2: EndBlock
private static void EndBlock(IWriter writer, long headerPos)
{
var endPos = writer.Position;
writer.SeekTo(headerPos + 4);
writer.WriteUInt32((uint)(endPos - headerPos));
writer.SeekTo(endPos);
}
示例3: WritePatch
public static void WritePatch(Patch patch, IWriter writer)
{
writer.WriteInt32(AssemblyPatchMagic);
writer.WriteUInt32(0); // File size filled in later
writer.WriteByte(0); // No compression
WriteBlocks(patch, writer);
// Fill in the file size
long fileSize = writer.Position;
writer.SeekTo(4);
writer.WriteUInt32((uint)fileSize - 8);
writer.SeekTo(fileSize);
}
示例4: PatchData
/// <summary>
/// Applies a set of data changes to a stream.
/// </summary>
/// <param name="changes">The data changes to apply.</param>
/// <param name="baseOffset">The offset of the start of the area where the changes should be applied.</param>
/// <param name="writer">The stream to write changes to.</param>
public static void PatchData(IEnumerable<DataChange> changes, uint baseOffset, IWriter writer)
{
foreach (var change in changes)
{
writer.SeekTo(baseOffset + change.Offset);
writer.WriteBlock(change.Data);
}
}
示例5: WriteReflexive
/// <summary>
/// Writes data to a reflexive at a particular address.
/// </summary>
/// <param name="entries">The entries to write.</param>
/// <param name="address">The address to write to.</param>
/// <param name="layout">The layout of the data to write.</param>
/// <param name="metaArea">The meta area of the cache file.</param>
/// <param name="writer">The stream to write to.</param>
public static void WriteReflexive(IEnumerable<StructureValueCollection> entries, uint address, StructureLayout layout,
FileSegmentGroup metaArea, IWriter writer)
{
int offset = metaArea.PointerToOffset(address);
int index = 0;
foreach (StructureValueCollection entry in entries)
{
writer.SeekTo(offset + index*layout.Size);
StructureWriter.WriteStructure(entry, layout, writer);
index++;
}
}
示例6: FixBlockReferences
private void FixBlockReferences(DataBlock block, IWriter buffer, IStream stream)
{
foreach (DataBlockAddressFixup fixup in block.AddressFixups)
{
uint newAddress = InjectDataBlock(fixup.OriginalAddress, stream);
buffer.SeekTo(fixup.WriteOffset);
buffer.WriteUInt32(newAddress);
}
}
示例7: WriteHeader
private void WriteHeader(IWriter writer)
{
writer.SeekTo(0);
StructureWriter.WriteStructure(_header.Serialize(), _buildInfo.Layouts.GetLayout("header"), writer);
}
示例8: SaveTag
public void SaveTag(StructureValueCollection values, IWriter writer)
{
writer.SeekTo(_tag.MetaLocation.AsOffset());
StructureWriter.WriteStructure(values, _buildInfo.Layouts.GetLayout("resource gestalt"), writer);
}
示例9: WriteChange
/// <summary>
/// Writes a meta change back to a cache file.
/// </summary>
/// <param name="cacheFile">The cache file to write the change to.</param>
/// <param name="change">The change to write.</param>
/// <param name="output">The stream to write the change to.</param>
public static void WriteChange(ICacheFile cacheFile, DataChange change, IWriter output)
{
output.SeekTo(cacheFile.MetaArea.PointerToOffset(change.Offset));
output.WriteBlock(change.Data);
}
示例10: WriteHeader
private void WriteHeader(IWriter writer)
{
// Serialize and write the header
StructureValueCollection values = _header.Serialize(_languageInfo.LocaleArea);
writer.SeekTo(0);
StructureWriter.WriteStructure(values, _buildInfo.GetLayout("header"), writer);
}
示例11: WriteHeader
private void WriteHeader(IWriter writer)
{
// Update tagname and stringid info (so. ugly.)
_header.FileNameCount = _fileNames.Count;
_header.StringIDCount = _stringIds.Count;
// Serialize and write the header
StructureValueCollection values = _header.Serialize(_languageInfo.LocaleArea);
writer.SeekTo(0);
StructureWriter.WriteStructure(values, _buildInfo.Layouts.GetLayout("header"), writer);
}
示例12: WritePatchInfo
private static void WritePatchInfo(Patch patch, IWriter writer)
{
long startPos = writer.Position;
writer.WriteInt32(AssemblyPatchBlockID.Titl);
writer.WriteUInt32(0); // Size filled in later
writer.WriteByte(0); // Version 0
writer.WriteInt32(patch.MapID);
if (patch.MapInternalName != null)
writer.WriteAscii(patch.MapInternalName);
else
writer.WriteByte(0);
writer.WriteUTF16(patch.Name);
writer.WriteUTF16(patch.Description);
writer.WriteUTF16(patch.Author);
if (patch.Screenshot != null)
{
writer.WriteInt32(patch.Screenshot.Length);
writer.WriteBlock(patch.Screenshot);
}
else
{
writer.WriteInt32(0);
}
// Fill in the block size
long endPos = writer.Position;
writer.SeekTo(startPos + 4);
writer.WriteUInt32((uint)(endPos - startPos));
writer.SeekTo(endPos);
}
示例13: FixStringIDReferences
private void FixStringIDReferences(DataBlock block, IWriter buffer)
{
foreach (DataBlockStringIDFixup fixup in block.StringIDFixups)
{
// Try to find the string, and if it's not found, inject it
StringID newSID = _cacheFile.StringIDs.FindStringID(fixup.OriginalString);
if (newSID == StringID.Null)
{
newSID = _cacheFile.StringIDs.AddString(fixup.OriginalString);
_injectedStrings.Add(newSID);
}
buffer.SeekTo(fixup.WriteOffset);
buffer.WriteUInt32(newSID.Value);
}
}
示例14: SaveChanges
/// <summary>
/// Saves changes made to the string list.
/// </summary>
/// <param name="writer">The stream to write to.</param>
public void SaveChanges(IWriter writer)
{
var values = new StructureValueCollection();
StructureValueCollection[] rangeValues = Ranges.Select(r => r.Serialize()).ToArray();
values.SetArray("language ranges", rangeValues);
writer.SeekTo(Tag.MetaLocation.AsOffset());
StructureWriter.WriteStructure(values, _layout, writer);
}
示例15: SaveHeader
private void SaveHeader(StructureValueCollection headerValues, IWriter writer)
{
if (_indexHeaderLocation != null)
{
writer.SeekTo(_indexHeaderLocation.AsOffset());
StructureLayout headerLayout = _buildInfo.Layouts.GetLayout("index header");
StructureWriter.WriteStructure(headerValues, headerLayout, writer);
}
}