本文整理汇总了C#中IWriter.WriteAscii方法的典型用法代码示例。如果您正苦于以下问题:C# IWriter.WriteAscii方法的具体用法?C# IWriter.WriteAscii怎么用?C# IWriter.WriteAscii使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWriter
的用法示例。
在下文中一共展示了IWriter.WriteAscii方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WritePatchInfo
private static void WritePatchInfo(Patch patch, ContainerWriter container, IWriter writer)
{
container.StartBlock("titl", 2); // Version 2
// Write target map info
writer.WriteInt32(patch.MapID);
if (patch.MapInternalName != null)
writer.WriteAscii(patch.MapInternalName);
else
writer.WriteByte(0);
// Write patch info
writer.WriteUTF16(patch.Name);
writer.WriteUTF16(patch.Description);
writer.WriteUTF16(patch.Author);
// Write screenshot
if (patch.Screenshot != null)
{
writer.WriteInt32(patch.Screenshot.Length);
writer.WriteBlock(patch.Screenshot);
}
else
{
writer.WriteInt32(0);
}
// Write meta info
writer.WriteUInt32(patch.MetaPokeBase);
writer.WriteSByte((sbyte) patch.MetaChangesIndex);
// Write output name
if (patch.OutputName != null)
writer.WriteAscii(patch.OutputName);
else
writer.WriteByte(0);
container.EndBlock();
}
示例2: WriteBlfInfo
private static void WriteBlfInfo(Patch patch, IWriter writer)
{
if (patch.CustomBlfContent == null)
return;
var startPos = WriteBlockHeader(writer, AssemblyPatchBlockID.Blfc);
writer.WriteByte(0); // Version 0
writer.WriteByte((byte)patch.CustomBlfContent.TargetGame);
// Write mapinfo filename
if (patch.CustomBlfContent.MapInfoFileName != null)
writer.WriteAscii(patch.CustomBlfContent.MapInfoFileName);
else
writer.WriteByte(0);
// Write mapinfo data
if (patch.CustomBlfContent.MapInfo != null)
{
writer.WriteUInt32((uint)patch.CustomBlfContent.MapInfo.Length);
writer.WriteBlock(patch.CustomBlfContent.MapInfo);
}
else
{
writer.WriteUInt32(0);
}
// Write BLF containers
writer.WriteInt16((short)patch.CustomBlfContent.BlfContainerEntries.Count);
foreach (var blfContainerEntry in patch.CustomBlfContent.BlfContainerEntries)
{
writer.WriteAscii(blfContainerEntry.FileName);
writer.WriteUInt32((uint)blfContainerEntry.BlfContainer.Length);
writer.WriteBlock(blfContainerEntry.BlfContainer);
}
EndBlock(writer, startPos);
}
示例3: WriteBlfInfo
private static void WriteBlfInfo(Patch patch, ContainerWriter container, IWriter writer)
{
if (patch.CustomBlfContent == null)
return;
container.StartBlock("blfc", 0); // Version 0
writer.WriteByte((byte) patch.CustomBlfContent.TargetGame);
// Write mapinfo filename
if (patch.CustomBlfContent.MapInfoFileName != null)
writer.WriteAscii(patch.CustomBlfContent.MapInfoFileName);
else
writer.WriteByte(0);
// Write mapinfo data
if (patch.CustomBlfContent.MapInfo != null)
{
writer.WriteUInt32((uint) patch.CustomBlfContent.MapInfo.Length);
writer.WriteBlock(patch.CustomBlfContent.MapInfo);
}
else
{
writer.WriteUInt32(0);
}
// Write BLF containers
writer.WriteInt16((short) patch.CustomBlfContent.BlfContainerEntries.Count);
foreach (BlfContainerEntry blfContainerEntry in patch.CustomBlfContent.BlfContainerEntries)
{
writer.WriteAscii(blfContainerEntry.FileName);
writer.WriteUInt32((uint) blfContainerEntry.BlfContainer.Length);
writer.WriteBlock(blfContainerEntry.BlfContainer);
}
container.EndBlock();
}
示例4: WriteDataBlocks
private static void WriteDataBlocks(TagContainer tags, ContainerWriter container, IWriter writer)
{
foreach (DataBlock dataBlock in tags.DataBlocks)
{
container.StartBlock("data", 2);
// Main data
writer.WriteUInt32(dataBlock.OriginalAddress);
writer.WriteInt32(dataBlock.EntryCount);
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);
}
container.EndBlock();
}
}
示例5: 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();
}
}
示例6: WriteTags
private static void WriteTags(TagContainer tags, ContainerWriter container, IWriter writer)
{
foreach (ExtractedTag tag in tags.Tags)
{
container.StartBlock("tag!", 0);
writer.WriteUInt32(tag.OriginalIndex.Value);
writer.WriteUInt32(tag.OriginalAddress);
writer.WriteInt32(tag.Class);
writer.WriteAscii(tag.Name);
container.EndBlock();
}
}
示例7: WriteResources
private static void WriteResources(TagContainer tags, ContainerWriter container, IWriter writer)
{
foreach (ExtractedResourceInfo resource in tags.Resources)
{
container.StartBlock("rsrc", 1);
writer.WriteUInt32(resource.OriginalIndex.Value);
writer.WriteUInt32(resource.Flags);
if (resource.Type != null)
writer.WriteAscii(resource.Type);
else
writer.WriteByte(0);
WriteByteArray(resource.Info, writer);
writer.WriteUInt32(resource.OriginalParentTagIndex.Value);
if (resource.Location != null)
{
writer.WriteByte(1);
writer.WriteInt32(resource.Location.OriginalPrimaryPageIndex);
writer.WriteInt32(resource.Location.PrimaryOffset);
writer.WriteInt32(resource.Location.PrimaryUnknown);
writer.WriteInt32(resource.Location.OriginalSecondaryPageIndex);
writer.WriteInt32(resource.Location.SecondaryOffset);
writer.WriteInt32(resource.Location.SecondaryUnknown);
}
else
{
writer.WriteByte(0);
}
writer.WriteInt32(resource.Unknown1);
writer.WriteInt32(resource.Unknown2);
writer.WriteInt32(resource.Unknown3);
writer.WriteInt32(resource.ResourceFixups.Count);
foreach (ResourceFixup fixup in resource.ResourceFixups)
{
writer.WriteInt32(fixup.Offset);
writer.WriteUInt32(fixup.Address);
}
writer.WriteInt32(resource.DefinitionFixups.Count);
foreach (ResourceDefinitionFixup fixup in resource.DefinitionFixups)
{
writer.WriteInt32(fixup.Offset);
writer.WriteInt32(fixup.Type);
}
container.EndBlock();
}
}
示例8: 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);
}
示例9: WritePatchInfo
private static void WritePatchInfo(Patch patch, IWriter writer)
{
var startPos = WriteBlockHeader(writer, AssemblyPatchBlockID.Titl);
writer.WriteByte(1); // Version 1
// Write target map info
writer.WriteInt32(patch.MapID);
if (patch.MapInternalName != null)
writer.WriteAscii(patch.MapInternalName);
else
writer.WriteByte(0);
// Write patch info
writer.WriteUTF16(patch.Name);
writer.WriteUTF16(patch.Description);
writer.WriteUTF16(patch.Author);
// Write screenshot
if (patch.Screenshot != null)
{
writer.WriteInt32(patch.Screenshot.Length);
writer.WriteBlock(patch.Screenshot);
}
else
{
writer.WriteInt32(0);
}
// Write meta info
writer.WriteUInt32(patch.MetaPokeBase);
writer.WriteSByte((sbyte)patch.MetaChangesIndex);
EndBlock(writer, startPos);
}
示例10: 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();
}
}