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


C# IReader.ReadUInt32方法代码示例

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


在下文中一共展示了IReader.ReadUInt32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadDataBlock

        private static DataBlock ReadDataBlock(IReader reader, byte version)
        {
            if (version > 2)
                throw new InvalidOperationException("Unrecognized \"data\" block version");

            // Block data
            uint originalAddress = reader.ReadUInt32();
            int entryCount = (version >= 1) ? reader.ReadInt32() : 1;
            byte[] data = ReadByteArray(reader);
            var block = new DataBlock(originalAddress, entryCount, data);

            // Address fixups
            int numAddressFixups = reader.ReadInt32();
            for (int i = 0; i < numAddressFixups; i++)
            {
                uint dataAddress = reader.ReadUInt32();
                int writeOffset = reader.ReadInt32();
                block.AddressFixups.Add(new DataBlockAddressFixup(dataAddress, writeOffset));
            }

            // Tagref fixups
            int numTagFixups = reader.ReadInt32();
            for (int i = 0; i < numTagFixups; i++)
            {
                var datum = new DatumIndex(reader.ReadUInt32());
                int writeOffset = reader.ReadInt32();
                block.TagFixups.Add(new DataBlockTagFixup(datum, writeOffset));
            }

            // Resource reference fixups
            int numResourceFixups = reader.ReadInt32();
            for (int i = 0; i < numResourceFixups; i++)
            {
                var datum = new DatumIndex(reader.ReadUInt32());
                int writeOffset = reader.ReadInt32();
                block.ResourceFixups.Add(new DataBlockResourceFixup(datum, writeOffset));
            }

            if (version >= 2)
            {
                // StringID fixups
                int numSIDFixups = reader.ReadInt32();
                for (int i = 0; i < numSIDFixups; i++)
                {
                    string str = reader.ReadAscii();
                    int writeOffset = reader.ReadInt32();
                    block.StringIDFixups.Add(new DataBlockStringIDFixup(str, writeOffset));
                }
            }

            return block;
        }
开发者ID:Cloms,项目名称:Assembly,代码行数:52,代码来源:TagContainerReader.cs

示例2: LoadPatch

        public static Patch LoadPatch(IReader reader, bool isAlteration)
        {
            Patch patch = new Patch();
            SegmentChange change = new SegmentChange(0, 0, 0, 0, true);
            patch.Author = "Ascension/Alteration Patch";
            patch.Description = "Ascension/Alteration Patch";
            if (isAlteration)
            {
                //do shitty alteration stuff
                byte authorLength = reader.ReadByte();
                patch.Author = reader.ReadAscii((int)authorLength);
                byte descLength = reader.ReadByte();
                patch.Description = reader.ReadAscii((int)descLength);

            }
            //create ascension patch object and change segment

            while (!reader.EOF)
            {
                //get valuable info
                var segmentOffset = reader.ReadUInt32();
                var segmentSize = reader.ReadInt32();
                var segmentData = reader.ReadBlock(segmentSize);

                //Add change data

                change.DataChanges.Add(new DataChange(segmentOffset, segmentData));

            }
            patch.SegmentChanges.Add(change);
            return patch;
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:32,代码来源:OldPatchLoader.cs

示例3: GetTagAddress

        public static uint GetTagAddress(IReader memoryReader, ushort index, uint exeBase)
        {
            //uint newcountaddr = MaxTagCountAddress;
            // Read the tag count and validate the tag index
            memoryReader.SeekTo(MaxTagCountAddress + exeBase);
            var maxIndex = memoryReader.ReadUInt16();
            if (index >= maxIndex)
                return 0;

            // Read the tag index table to get the index of the tag in the address table
            memoryReader.SeekTo(TagIndexArrayPointerAddress + exeBase);
            var tagIndexTableAddress = memoryReader.ReadUInt32();
            if (tagIndexTableAddress == 0)
                return 0;
            memoryReader.SeekTo(tagIndexTableAddress + index * 4);
            var addressIndex = memoryReader.ReadInt32();
            if (addressIndex < 0)
                return 0;

            // Read the tag's address in the address table
            memoryReader.SeekTo(TagAddressArrayPointerAddress + exeBase);
            var tagAddressTableAddress = memoryReader.ReadUInt32();
            if (tagAddressTableAddress == 0)
                return 0;
            memoryReader.SeekTo(tagAddressTableAddress + addressIndex * 4);
            return memoryReader.ReadUInt32();
        }
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:27,代码来源:EldoradoRTEProvider.cs

示例4: ReadPatchInfo

		private static void ReadPatchInfo(IReader reader, byte version, Patch output)
		{
			// Version 0 (all versions)
			output.MapID = reader.ReadInt32();
			output.MapInternalName = reader.ReadAscii();
			output.Name = reader.ReadUTF16();
			output.Description = reader.ReadUTF16();
			output.Author = reader.ReadUTF16();

			int screenshotLength = reader.ReadInt32();
			if (screenshotLength > 0)
				output.Screenshot = reader.ReadBlock(screenshotLength);

			// Version 1
			if (version >= 1)
			{
				output.MetaPokeBase = reader.ReadUInt32();
				output.MetaChangesIndex = reader.ReadSByte();
			}

			// Version 2
			if (version >= 2)
				output.OutputName = reader.ReadAscii();
			else
				output.OutputName = "";
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:26,代码来源:AssemblyPatchLoader.cs

示例5: ReadBlfInfo

        private static void ReadBlfInfo(IReader reader, Patch output)
        {
            // Version 0 (all versions)
            var targetGame = (TargetGame) reader.ReadByte();
            string mapInfoFileName = reader.ReadAscii();
            uint mapInfoLength = reader.ReadUInt32();
            byte[] mapInfo = reader.ReadBlock((int) mapInfoLength);
            short blfContainerCount = reader.ReadInt16();
            output.CustomBlfContent = new BlfContent(mapInfoFileName, mapInfo, targetGame);
            for (int i = 0; i < blfContainerCount; i++)
            {
                string fileName = Path.GetFileName(reader.ReadAscii());
                uint blfContainerLength = reader.ReadUInt32();
                byte[] blfContainer = reader.ReadBlock((int) blfContainerLength);

                output.CustomBlfContent.BlfContainerEntries.Add(new BlfContainerEntry(fileName, blfContainer));
            }
        }
开发者ID:ChadSki,项目名称:Assembly,代码行数:18,代码来源:AssemblyPatchLoader.cs

示例6: LoadPatch

        public static Patch LoadPatch(IReader reader)
        {
            int magic = reader.ReadInt32();
            if (magic != AssemblyPatchMagic)
                throw new InvalidOperationException("Invalid Assembly patch magic");
            uint size = reader.ReadUInt32();
            byte compression = reader.ReadByte();
            if (compression > 0)
                throw new InvalidOperationException("Unrecognized patch compression type");

            return ReadBlocks(reader, 9, size + 8);
        }
开发者ID:YxCREATURExY,项目名称:Assembly,代码行数:12,代码来源:AssemblyPatchLoader.cs

示例7: ReadBlfInfo

        private static void ReadBlfInfo(IReader reader, Patch output)
        {
            // ReSharper disable UnusedVariable
            var version = reader.ReadByte();
            // ReSharper restore UnusedVariable

            // Version 0 (all versions)
            var targetGame = (TargetGame)reader.ReadByte();
            var mapInfoFileName = reader.ReadAscii();
            var mapInfoLength = reader.ReadUInt32();
            var mapInfo = reader.ReadBlock((int)mapInfoLength);
            var blfContainerCount = reader.ReadInt16();
            output.CustomBlfContent = new BlfContent(mapInfoFileName, mapInfo, targetGame);
            for (var i = 0; i < blfContainerCount; i++)
            {
                var fileName = Path.GetFileName(reader.ReadAscii());
                var blfContainerLength = reader.ReadUInt32();
                var blfContainer = reader.ReadBlock((int)blfContainerLength);

                output.CustomBlfContent.BlfContainerEntries.Add(new BlfContainerEntry(fileName, blfContainer));
            }
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:22,代码来源:AssemblyPatchLoader.cs

示例8: ReadMetaChanges

        private static void ReadMetaChanges(IReader reader, Patch output)
        {
            byte version = reader.ReadByte();

            // Version 0 (all versions)
            uint num4ByteChanges = 0;
            for (uint i = 0; i < num4ByteChanges; i++)
            {
                uint address = reader.ReadUInt32();
                byte[] data = reader.ReadBlock(4);
                output.MetaChanges.Add(new MetaChange(address, data));
            }

            uint numChanges = 0;
            for (uint i = 0; i < numChanges; i++)
            {
                uint address = reader.ReadUInt32();
                uint dataSize = reader.ReadUInt32();
                byte[] data = reader.ReadBlock((int)dataSize);
                output.MetaChanges.Add(new MetaChange(address, data));
            }
        }
开发者ID:YxCREATURExY,项目名称:Assembly,代码行数:22,代码来源:AssemblyPatchLoader.cs

示例9: DetectAlignment

        static void DetectAlignment(ICacheFile cacheFile, IReader reader, int baseOffset, XElement baseElement, Dictionary<XElement, int> alignsByElem, HashSet<uint> visitedTagBlocks)
        {
            // Loop through all tag blocks and data references
            foreach (var elem in baseElement.Elements())
            {
                var isTagBlock = (elem.Name.LocalName == "reflexive");
                var isDataRef = (elem.Name.LocalName == "dataRef");
                if (!isTagBlock && !isDataRef)
                    continue;

                // Read the address
                var offset = ParseInteger(elem.Attribute("offset").Value);
                var count = 0;
                var entrySize = 0;
                if (isTagBlock)
                {
                    reader.SeekTo(baseOffset + offset);
                    count = reader.ReadInt32();
                    entrySize = ParseInteger(elem.Attribute("entrySize").Value);
                }
                else
                {
                    reader.SeekTo(baseOffset + offset + 0xC);
                }

                var addr = reader.ReadUInt32();
                if (addr == 0)
                    continue;
                if (isTagBlock && !cacheFile.MetaArea.ContainsBlockPointer(addr, count * entrySize))
                    continue;

                // Only update the alignment if it's less than the currently-guessed alignment
                int oldAlign;
                var newAlign = GetAlignment(addr);
                if (!alignsByElem.TryGetValue(elem, out oldAlign) || newAlign < oldAlign)
                    alignsByElem[elem] = newAlign;

                // If it's a tag block, then recurse into it
                if (isTagBlock && !visitedTagBlocks.Contains(addr))
                {
                    visitedTagBlocks.Add(addr);
                    var blockBaseOffset = cacheFile.MetaArea.PointerToOffset(addr);
                    for (var i = 0; i < count; i++)
                        DetectAlignment(cacheFile, reader, blockBaseOffset + i * entrySize, elem, alignsByElem, visitedTagBlocks);
                }
            }
        }
开发者ID:ChadSki,项目名称:Assembly,代码行数:47,代码来源:Program.cs

示例10: LoadPatch

        public static Patch LoadPatch(IReader reader)
        {
            // Verify header magic
            var magic = reader.ReadInt32();
            if (magic != AssemblyPatchMagic)
                throw new InvalidOperationException("Invalid Assembly patch magic");

            // Read the file size
            var size = reader.ReadUInt32();

            // Read the compression type
            var compression = reader.ReadByte();
            if (compression > 0)
                throw new InvalidOperationException("Unrecognized patch compression type");

            return ReadBlocks(reader, 9, size);
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:17,代码来源:AssemblyPatchLoader.cs

示例11: ReadBlocks

        private static Patch ReadBlocks(IReader reader, uint startOffset, uint endOffset)
        {
            var result = new Patch();
            var offset = startOffset;
            while (offset < endOffset)
            {
                reader.SeekTo(offset);
                var blockId = reader.ReadInt32();
                var size = reader.ReadUInt32();

                switch (blockId)
                {
                    case AssemblyPatchBlockID.Titl:
                        ReadPatchInfo(reader, result);
                        break;

                    case AssemblyPatchBlockID.Segm:
                        ReadSegmentChanges(reader, result);
                        break;

                    case AssemblyPatchBlockID.Blfc:
                        ReadBlfInfo(reader, result);
                        break;

                    #region Deprecated
                    case AssemblyPatchBlockID.Meta:
                        ReadMetaChanges(reader, result);
                        break;

                    case AssemblyPatchBlockID.Locl:
                        ReadLocaleChanges(reader, result);
                        break;
                    #endregion Deprecated
                }

                // Skip to the next block
                offset += size;
            }
            return result;
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:40,代码来源:AssemblyPatchLoader.cs

示例12: ReadDataChanges

        private static List<DataChange> ReadDataChanges(IReader reader)
        {
            var result = new List<DataChange>();

            uint numFourByteChanges = reader.ReadUInt32();
            for (int j = 0; j < numFourByteChanges; j++)
            {
                uint offset = reader.ReadUInt32();
                byte[] data = reader.ReadBlock(4);
                result.Add(new DataChange(offset, data));
            }

            uint numOtherChanges = reader.ReadUInt32();
            for (int j = 0; j < numOtherChanges; j++)
            {
                uint offset = reader.ReadUInt32();
                int dataSize = reader.ReadInt32();
                byte[] data = reader.ReadBlock(dataSize);
                result.Add(new DataChange(offset, data));
            }

            return result;
        }
开发者ID:ChadSki,项目名称:Assembly,代码行数:23,代码来源:AssemblyPatchLoader.cs

示例13: ReadBlocks

        private static Patch ReadBlocks(IReader reader, uint offset, uint endOffset)
        {
            Patch result = new Patch();
            while (offset < endOffset)
            {
                reader.SeekTo(offset);
                int blockId = reader.ReadInt32();
                uint size = reader.ReadUInt32();

                switch (blockId)
                {
                    case AssemblyPatchBlockID.Titl:
                        ReadPatchInfo(reader, result);
                        break;
                    case AssemblyPatchBlockID.Meta:
                        ReadMetaChanges(reader, result);
                        break;
                }

                // Skip to the next block
                offset += size;
            }
            return result;
        }
开发者ID:YxCREATURExY,项目名称:Assembly,代码行数:24,代码来源:AssemblyPatchLoader.cs

示例14: ReadSegmentChanges

		private static void ReadSegmentChanges(IReader reader, Patch output)
		{
			// Version 0 (all versions)
			byte numChanges = reader.ReadByte();
			for (int i = 0; i < numChanges; i++)
			{
				uint oldOffset = reader.ReadUInt32();
				int oldSize = reader.ReadInt32();
				uint newOffset = reader.ReadUInt32();
				int newSize = reader.ReadInt32();
				bool resizeAtEnd = Convert.ToBoolean(reader.ReadByte());
				var segmentChange = new SegmentChange(oldOffset, oldSize, newOffset, newSize, resizeAtEnd);
				segmentChange.DataChanges.AddRange(ReadDataChanges(reader));

				output.SegmentChanges.Add(segmentChange);
			}
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:17,代码来源:AssemblyPatchLoader.cs

示例15: ReadResource

		private static ExtractedResourceInfo ReadResource(IReader reader, byte version)
		{
			if (version != 1)
				throw new InvalidOperationException("Unrecognized \"rsrc\" block version");

			var originalIndex = new DatumIndex(reader.ReadUInt32());
			var resource = new ExtractedResourceInfo(originalIndex);
			resource.Flags = reader.ReadUInt32();
			resource.Type = reader.ReadAscii();
			if (string.IsNullOrEmpty(resource.Type))
				resource.Type = null;
			resource.Info = ReadByteArray(reader);
			resource.OriginalParentTagIndex = new DatumIndex(reader.ReadUInt32());
			byte hasLocation = reader.ReadByte();
			if (hasLocation != 0)
			{
				resource.Location = new ExtractedResourcePointer();
				resource.Location.OriginalPrimaryPageIndex = reader.ReadInt32();
				resource.Location.PrimaryOffset = reader.ReadInt32();
				resource.Location.PrimaryUnknown = reader.ReadInt32();
				resource.Location.OriginalSecondaryPageIndex = reader.ReadInt32();
				resource.Location.SecondaryOffset = reader.ReadInt32();
				resource.Location.SecondaryUnknown = reader.ReadInt32();
			}
			resource.Unknown1 = reader.ReadInt32();
			resource.Unknown2 = reader.ReadInt32();
			resource.Unknown3 = reader.ReadInt32();

			int numResourceFixups = reader.ReadInt32();
			for (int i = 0; i < numResourceFixups; i++)
			{
				var fixup = new ResourceFixup();
				fixup.Offset = reader.ReadInt32();
				fixup.Address = reader.ReadUInt32();
				resource.ResourceFixups.Add(fixup);
			}

			int numDefinitionFixups = reader.ReadInt32();
			for (int i = 0; i < numDefinitionFixups; i++)
			{
				var fixup = new ResourceDefinitionFixup();
				fixup.Offset = reader.ReadInt32();
				fixup.Type = reader.ReadInt32();
				resource.DefinitionFixups.Add(fixup);
			}

			return resource;
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:48,代码来源:TagContainerReader.cs


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