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


C# IReader.ReadByte方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: ReadPatchInfo

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

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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: ReadResourcePage

		private static ResourcePage ReadResourcePage(IReader reader, byte version)
		{
			if (version > 1)
				throw new InvalidOperationException("Unrecognized \"rspg\" block version");

			var page = new ResourcePage();
			page.Index = reader.ReadInt32();
			if (version > 0)
				page.Salt = reader.ReadUInt16();
			page.Flags = reader.ReadByte();
			page.FilePath = reader.ReadAscii();
			if (page.FilePath.Length == 0)
				page.FilePath = null;
			page.Offset = reader.ReadInt32();
			page.UncompressedSize = reader.ReadInt32();
			page.CompressionMethod = (ResourcePageCompression) reader.ReadByte();
			page.CompressedSize = reader.ReadInt32();
			page.Checksum = reader.ReadUInt32();
			page.Hash1 = ReadByteArray(reader);
			page.Hash2 = ReadByteArray(reader);
			page.Hash3 = ReadByteArray(reader);
			page.Unknown1 = reader.ReadInt32();
			page.Unknown2 = reader.ReadInt32();
			page.Unknown3 = reader.ReadInt32();
			return page;
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:26,代码来源:TagContainerReader.cs

示例10: ReadElement

		/// <summary>
		///     Reads a vertex element from a stream and sends it to an IVertexProcessor.
		/// </summary>
		/// <param name="reader">The stream to read from. It should be positioned at the start of the element.</param>
		/// <param name="element">The layout of the element to read.</param>
		/// <param name="boundingBox">The bounding box to transform the element with. Can be null.</param>
		/// <param name="processor">The IVertexProcessor to send the element to.</param>
		private static void ReadElement(IReader reader, VertexElementLayout element, BoundingBox boundingBox,
			IVertexProcessor processor)
		{
			// EW EW EW
			// TODO: Implement everything, this is just enough to load some Reach vertices for now...
			float x = 0, y = 0, z = 0, w = 1;
			uint value;
			switch (element.Type)
			{
				case VertexElementType.Float2:
					x = reader.ReadFloat();
					y = reader.ReadFloat();
					break;

				case VertexElementType.Float3:
					x = reader.ReadFloat();
					y = reader.ReadFloat();
					z = reader.ReadFloat();
					break;

				case VertexElementType.Float4:
					x = reader.ReadFloat();
					y = reader.ReadFloat();
					z = reader.ReadFloat();
					w = reader.ReadFloat();
					break;

				case VertexElementType.UByte4:
					x = reader.ReadByte();
					y = reader.ReadByte();
					z = reader.ReadByte();
					w = reader.ReadByte();
					break;

				case VertexElementType.UByte4N:
					x = reader.ReadByte()/255.0f;
					y = reader.ReadByte()/255.0f;
					z = reader.ReadByte()/255.0f;
					w = reader.ReadByte()/255.0f;
					break;

				case VertexElementType.Byte4N:
					x = reader.ReadSByte()/127.0f;
					y = reader.ReadSByte()/127.0f;
					z = reader.ReadSByte()/127.0f;
					w = reader.ReadSByte()/127.0f;
					break;

				case VertexElementType.Float16_2:
					x = Half.ToHalf(reader.ReadUInt16());
					y = Half.ToHalf(reader.ReadUInt16());
					break;

				case VertexElementType.Float16_4:
					x = Half.ToHalf(reader.ReadUInt16());
					y = Half.ToHalf(reader.ReadUInt16());
					z = Half.ToHalf(reader.ReadUInt16());
					w = Half.ToHalf(reader.ReadUInt16());
					break;

				case VertexElementType.UShort2:
					x = reader.ReadUInt16();
					y = reader.ReadUInt16();
					break;

				case VertexElementType.UShort2N:
					x = reader.ReadUInt16()/65535.0f;
					y = reader.ReadUInt16()/65535.0f;
					break;

				case VertexElementType.UShort4N:
					x = reader.ReadUInt16()/65535.0f;
					y = reader.ReadUInt16()/65535.0f;
					z = reader.ReadUInt16()/65535.0f;
					w = reader.ReadUInt16()/65535.0f;
					break;

				case VertexElementType.Short4N:
					x = reader.ReadInt16()/32767.0f;
					y = reader.ReadInt16()/32767.0f;
					z = reader.ReadInt16()/32767.0f;
					w = reader.ReadInt16()/32767.0f;
					break;

				case VertexElementType.D3DColor:
					w = reader.ReadByte()/255.0f; // W is set here because alpha comes first but ends up last in the vector
					y = reader.ReadByte()/255.0f;
					z = reader.ReadByte()/255.0f;
					x = reader.ReadByte()/255.0f;
					break;

				case VertexElementType.DHen3N:
					value = reader.ReadUInt32();
//.........这里部分代码省略.........
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:101,代码来源:VertexBufferReader.cs

示例11: ReadSegmentChanges

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

            // Version 0 (all versions)
            var numChanges = reader.ReadByte();
            for (var i = 0; i < numChanges; i++)
            {
                var oldOffset = reader.ReadUInt32();
                var oldSize = reader.ReadInt32();
                var newOffset = reader.ReadUInt32();
                var newSize = reader.ReadInt32();
                var resizeAtEnd = Convert.ToBoolean(reader.ReadByte());
                var segmentChange = new SegmentChange(oldOffset, oldSize, newOffset, newSize, resizeAtEnd);
                segmentChange.DataChanges.AddRange(ReadDataChanges(reader));

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

示例12: ReadPatchInfo

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

            // Version 0 (all versions)
            output.MapID = reader.ReadInt32();
            output.MapInternalName = reader.ReadAscii();
            output.Name = reader.ReadUTF16();
            output.Description = reader.ReadUTF16();
            output.Author = reader.ReadUTF16();

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

            // Version 1
            if (version == 1)
            {
                output.MetaPokeBase = reader.ReadUInt32();
                output.MetaChangesIndex = reader.ReadSByte();
            }
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:24,代码来源:AssemblyPatchLoader.cs

示例13: ReadMetaChanges

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

            output.MetaChanges.AddRange(ReadDataChanges(reader));
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:8,代码来源:AssemblyPatchLoader.cs

示例14: ReadLocaleChanges

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

            // Read language changes
            var numLanguageChanges = reader.ReadByte();
            for (byte i = 0; i < numLanguageChanges; i++)
            {
                var languageIndex = reader.ReadByte();
                var languageChange = new LanguageChange(languageIndex);

                // Read string changes
                var numStringChanges = reader.ReadInt32();
                for (var j = 0; j < numStringChanges; j++)
                {
                    var index = reader.ReadInt32();
                    var newValue = reader.ReadUTF8();
                    languageChange.LocaleChanges.Add(new LocaleChange(index, newValue));
                }

                output.LanguageChanges.Add(languageChange);
            }
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:25,代码来源:AssemblyPatchLoader.cs

示例15: 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


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