本文整理汇总了C#中IWriter.WriteUTF8方法的典型用法代码示例。如果您正苦于以下问题:C# IWriter.WriteUTF8方法的具体用法?C# IWriter.WriteUTF8怎么用?C# IWriter.WriteUTF8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWriter
的用法示例。
在下文中一共展示了IWriter.WriteUTF8方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: WriteLocaleChanges
private static void WriteLocaleChanges(Patch patch, ContainerWriter container, IWriter writer)
{
if (patch.LanguageChanges.Count == 0)
return;
container.StartBlock("locl", 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.WriteInt32(change.Index);
writer.WriteUTF8(change.NewValue);
}
}
container.EndBlock();
}
示例3: WriteLocaleChanges
private static void WriteLocaleChanges(Patch patch, IWriter writer)
{
if (patch.LanguageChanges.Count == 0)
return;
var startPos = WriteBlockHeader(writer, AssemblyPatchBlockID.Locl);
writer.WriteByte(0); // Version 0
// Write change data for each language
writer.WriteByte((byte)patch.LanguageChanges.Count);
foreach (var language in patch.LanguageChanges)
{
writer.WriteByte(language.LanguageIndex);
// Write the change data for each string in the language
writer.WriteInt32(language.LocaleChanges.Count);
foreach (var change in language.LocaleChanges)
{
writer.WriteInt32(change.Index);
writer.WriteUTF8(change.NewValue);
}
}
EndBlock(writer, startPos);
}
示例4: WriteDataBlocks
private static void WriteDataBlocks(TagContainer tags, ContainerWriter container, IWriter writer)
{
foreach (DataBlock dataBlock in tags.DataBlocks)
{
container.StartBlock("data", 6);
// Main data
writer.WriteUInt32(dataBlock.OriginalAddress);
writer.WriteInt32(dataBlock.EntryCount);
writer.WriteInt32(dataBlock.Alignment);
WriteByteArray(dataBlock.Data, writer);
// Address fixups
writer.WriteInt32(dataBlock.AddressFixups.Count);
foreach (DataBlockAddressFixup blockRef in dataBlock.AddressFixups)
{
writer.WriteUInt32(blockRef.OriginalAddress);
writer.WriteInt32(blockRef.WriteOffset);
}
// Tagref fixups
writer.WriteInt32(dataBlock.TagFixups.Count);
foreach (DataBlockTagFixup tagRef in dataBlock.TagFixups)
{
writer.WriteUInt32(tagRef.OriginalIndex.Value);
writer.WriteInt32(tagRef.WriteOffset);
}
// Resource reference fixups
writer.WriteInt32(dataBlock.ResourceFixups.Count);
foreach (DataBlockResourceFixup resourceRef in dataBlock.ResourceFixups)
{
writer.WriteUInt32(resourceRef.OriginalIndex.Value);
writer.WriteInt32(resourceRef.WriteOffset);
}
// StringID fixups
writer.WriteInt32(dataBlock.StringIDFixups.Count);
foreach (DataBlockStringIDFixup sid in dataBlock.StringIDFixups)
{
writer.WriteAscii(sid.OriginalString);
writer.WriteInt32(sid.WriteOffset);
}
// Shader fixups
writer.WriteInt32(dataBlock.ShaderFixups.Count);
foreach (DataBlockShaderFixup shaderRef in dataBlock.ShaderFixups)
{
writer.WriteInt32(shaderRef.WriteOffset);
if (shaderRef.Data != null)
{
writer.WriteInt32(shaderRef.Data.Length);
writer.WriteBlock(shaderRef.Data);
}
else
{
writer.WriteInt32(0);
}
}
// Unicode string list fixups
writer.WriteInt32(dataBlock.UnicListFixups.Count);
foreach (DataBlockUnicListFixup unicList in dataBlock.UnicListFixups)
{
writer.WriteInt32(unicList.LanguageIndex);
writer.WriteInt32(unicList.WriteOffset);
writer.WriteInt32(unicList.Strings.Length);
foreach (UnicListFixupString str in unicList.Strings)
{
writer.WriteAscii(str.StringID);
writer.WriteUTF8(str.String);
}
}
container.EndBlock();
}
}