当前位置: 首页>>代码示例>>C#>>正文


C# IWriter.WriteInt32方法代码示例

本文整理汇总了C#中IWriter.WriteInt32方法的典型用法代码示例。如果您正苦于以下问题:C# IWriter.WriteInt32方法的具体用法?C# IWriter.WriteInt32怎么用?C# IWriter.WriteInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IWriter的用法示例。


在下文中一共展示了IWriter.WriteInt32方法的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);
        }
开发者ID:YxCREATURExY,项目名称:Assembly,代码行数:31,代码来源:AssemblyPatchWriter.cs

示例2: WriteByteArray

 private static void WriteByteArray(byte[] data, IWriter writer)
 {
     if (data != null)
     {
         writer.WriteInt32(data.Length);
         writer.WriteBlock(data);
     }
     else
     {
         writer.WriteInt32(0);
     }
 }
开发者ID:Cloms,项目名称:Assembly,代码行数:12,代码来源:TagContainerWriter.cs

示例3: WriteBlockHeader

 private static long WriteBlockHeader(IWriter writer, int magic)
 {
     var startPos = writer.Position;
     writer.WriteInt32(magic);
     writer.WriteUInt32(0); // Size filled in later
     return startPos;
 }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:7,代码来源:AssemblyPatchWriter.cs

示例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();
            }
        }
开发者ID:Cloms,项目名称:Assembly,代码行数:46,代码来源:TagContainerWriter.cs

示例5: WriteSegmentChanges

		private static void WriteSegmentChanges(Patch patch, ContainerWriter container, IWriter writer)
		{
			if (patch.SegmentChanges.Count == 0)
				return;

			container.StartBlock("segm", 0); // Version 0

			writer.WriteByte((byte) patch.SegmentChanges.Count);
			foreach (SegmentChange segment in patch.SegmentChanges)
			{
				writer.WriteUInt32(segment.OldOffset);
				writer.WriteInt32(segment.OldSize);
				writer.WriteUInt32(segment.NewOffset);
				writer.WriteInt32(segment.NewSize);
				writer.WriteByte(Convert.ToByte(segment.ResizeAtEnd));

				WriteDataChanges(segment.DataChanges, writer);
			}

			container.EndBlock();
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:21,代码来源:AssemblyPatchWriter.cs

示例6: 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();
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:39,代码来源:AssemblyPatchWriter.cs

示例7: 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);
        }
开发者ID:YxCREATURExY,项目名称:Assembly,代码行数:14,代码来源:AssemblyPatchWriter.cs

示例8: WriteMetaChanges

        private static void WriteMetaChanges(Patch patch, IWriter writer)
        {
            if (patch.MetaChanges.Count == 0)
                return;

            long startPos = writer.Position;
            writer.WriteInt32(AssemblyPatchBlockID.Meta);
            writer.WriteUInt32(0); // Size filled in later
            writer.WriteByte(0); // Version 0

            // Filter meta changes by size (as a file size optimization)
            List<MetaChange> fourByteChanges = new List<MetaChange>();
            List<MetaChange> otherChanges = new List<MetaChange>();
            foreach (MetaChange change in patch.MetaChanges)
            {
                if (change.Data.Length == 4)
                    fourByteChanges.Add(change);
                else
                    otherChanges.Add(change);
            }

            // Write 4-byte changes
            writer.WriteUInt32((uint)fourByteChanges.Count);
            foreach (MetaChange change in fourByteChanges)
            {
                writer.WriteUInt32(change.Address);
                writer.WriteBlock(change.Data);
            }

            // Write other changes
            writer.WriteUInt32((uint)otherChanges.Count);
            foreach (MetaChange change in otherChanges)
            {
                writer.WriteUInt32(change.Address);
                writer.WriteUInt32((uint)change.Data.Length);
                writer.WriteBlock(change.Data);
            }

            // Fill in the block size
            long endPos = writer.Position;
            writer.SeekTo(startPos + 4);
            writer.WriteUInt32((uint)(endPos - startPos));
            writer.SeekTo(endPos);
        }
开发者ID:YxCREATURExY,项目名称:Assembly,代码行数:44,代码来源:AssemblyPatchWriter.cs

示例9: 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();
            }
        }
开发者ID:Cloms,项目名称:Assembly,代码行数:49,代码来源:TagContainerWriter.cs

示例10: WriteDataChanges

		private static void WriteDataChanges(IList<DataChange> changes, IWriter writer)
		{
			List<DataChange> fourByteChanges = changes.Where(c => c.Data.Length == 4).ToList();
			List<DataChange> otherChanges = changes.Where(c => c.Data.Length != 4).ToList();

			// Write 4-byte changes
			writer.WriteUInt32((uint) fourByteChanges.Count);
			foreach (DataChange change in fourByteChanges)
			{
				writer.WriteUInt32(change.Offset);
				writer.WriteBlock(change.Data);
			}

			// Write other changes
			writer.WriteUInt32((uint) otherChanges.Count);
			foreach (DataChange change in otherChanges)
			{
				writer.WriteUInt32(change.Offset);
				writer.WriteInt32(change.Data.Length);
				writer.WriteBlock(change.Data);
			}
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:22,代码来源:AssemblyPatchWriter.cs

示例11: 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();
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:24,代码来源:AssemblyPatchWriter.cs

示例12: WriteMetaChanges

		private static void WriteMetaChanges(Patch patch, ContainerWriter container, IWriter writer)
		{
			if (patch.MetaChanges.Count == 0)
				return;

			container.StartBlock("meta", 0); // Version 0

			List<DataChange> fourByteChanges = patch.MetaChanges.Where(c => c.Data.Length == 4).ToList();
			List<DataChange> otherChanges = patch.MetaChanges.Where(c => c.Data.Length != 4).ToList();

			// Write 4-byte changes
			writer.WriteUInt32((uint) fourByteChanges.Count);
			foreach (DataChange change in fourByteChanges)
			{
				writer.WriteUInt32(change.Offset);
				writer.WriteBlock(change.Data);
			}

			// Write other changes
			writer.WriteUInt32((uint) otherChanges.Count);
			foreach (DataChange change in otherChanges)
			{
				writer.WriteUInt32(change.Offset);
				writer.WriteInt32(change.Data.Length);
				writer.WriteBlock(change.Data);
			}

			container.EndBlock();
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:29,代码来源:AssemblyPatchWriter.cs

示例13: WriteMetaChanges

        private static void WriteMetaChanges(Patch patch, IWriter writer)
        {
            if (patch.MetaChanges.Count == 0)
                return;

            var startPos = WriteBlockHeader(writer, AssemblyPatchBlockID.Meta);
            writer.WriteByte(0); // Version 0

            var fourByteChanges = patch.MetaChanges.Where((c) => c.Data.Length == 4).ToList();
            var otherChanges = patch.MetaChanges.Where((c) => c.Data.Length != 4).ToList();

            // Write 4-byte changes
            writer.WriteUInt32((uint)fourByteChanges.Count);
            foreach (var change in fourByteChanges)
            {
                writer.WriteUInt32(change.Offset);
                writer.WriteBlock(change.Data);
            }

            // Write other changes
            writer.WriteUInt32((uint)otherChanges.Count);
            foreach (var change in otherChanges)
            {
                writer.WriteUInt32(change.Offset);
                writer.WriteInt32(change.Data.Length);
                writer.WriteBlock(change.Data);
            }

            EndBlock(writer, startPos);
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:30,代码来源:AssemblyPatchWriter.cs

示例14: 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);
        }
开发者ID:YxCREATURExY,项目名称:Assembly,代码行数:31,代码来源:AssemblyPatchWriter.cs

示例15: WriteSegmentChanges

        private static void WriteSegmentChanges(Patch patch, IWriter writer)
        {
            if (patch.SegmentChanges.Count == 0)
                return;

            var startPos = WriteBlockHeader(writer, AssemblyPatchBlockID.Segm);
            writer.WriteByte(0); // Version 0

            writer.WriteByte((byte)patch.SegmentChanges.Count);
            foreach (var segment in patch.SegmentChanges)
            {
                writer.WriteUInt32(segment.OldOffset);
                writer.WriteInt32(segment.OldSize);
                writer.WriteUInt32(segment.NewOffset);
                writer.WriteInt32(segment.NewSize);
                writer.WriteByte(Convert.ToByte(segment.ResizeAtEnd));

                WriteDataChanges(segment.DataChanges, writer);
            }

            EndBlock(writer, startPos);
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:22,代码来源:AssemblyPatchWriter.cs


注:本文中的IWriter.WriteInt32方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。