本文整理汇总了C#中IWriter.WriteUInt16方法的典型用法代码示例。如果您正苦于以下问题:C# IWriter.WriteUInt16方法的具体用法?C# IWriter.WriteUInt16怎么用?C# IWriter.WriteUInt16使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWriter
的用法示例。
在下文中一共展示了IWriter.WriteUInt16方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: WriteResourcePages
private static void WriteResourcePages(TagContainer tags, ContainerWriter container, IWriter writer)
{
foreach (ResourcePage page in tags.ResourcePages)
{
container.StartBlock("rspg", 1);
writer.WriteInt32(page.Index);
writer.WriteUInt16(page.Salt);
writer.WriteByte(page.Flags);
writer.WriteAscii(page.FilePath ?? "");
writer.WriteInt32(page.Offset);
writer.WriteInt32(page.UncompressedSize);
writer.WriteByte((byte) page.CompressionMethod);
writer.WriteInt32(page.CompressedSize);
writer.WriteUInt32(page.Checksum);
WriteByteArray(page.Hash1, writer);
WriteByteArray(page.Hash2, writer);
WriteByteArray(page.Hash3, writer);
writer.WriteInt32(page.Unknown1);
writer.WriteInt32(page.Unknown2);
writer.WriteInt32(page.Unknown3);
container.EndBlock();
}
}
示例3: WriteIndexBuffer
/// <summary>
/// Writes an index buffer to a stream.
/// </summary>
/// <param name="writer">The stream to write to.</param>
/// <param name="indices">The indices to write.</param>
public static void WriteIndexBuffer(IWriter writer, ushort[] indices)
{
for (int i = 0; i < indices.Length; i++)
writer.WriteUInt16(indices[i]);
}