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


C# IReader.ReadAscii方法代码示例

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


在下文中一共展示了IReader.ReadAscii方法的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: 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

示例3: CacheFileVersionInfo

        public CacheFileVersionInfo(IReader reader)
        {
            reader.SeekTo(0x4);
            Version = reader.ReadInt32();

            if (Version == SecondGenVersion)
            {
                Engine = EngineType.SecondGeneration;

                // Read second-generation build string
                reader.SeekTo(0x12C);
                BuildString = reader.ReadAscii();
            }
            else if (Version >= ThirdGenVersion)
            {
                Engine = EngineType.ThirdGeneration;

                // Read third-generation build string
                reader.SeekTo(0x11C);
                BuildString = reader.ReadAscii();
            }

            if (string.IsNullOrWhiteSpace(BuildString))
            {
                // Assume it's a first-generation build
                Engine = EngineType.FirstGeneration;
                Version = 0;

                // Read first-generation build string
                reader.SeekTo(0x40);
                BuildString = reader.ReadAscii();
            }
        }
开发者ID:Nibre,项目名称:Assembly,代码行数:33,代码来源:CacheFileVersionInfo.cs

示例4: Load

        /// <summary>
        ///     Loads the strings into the StringTable
        /// </summary>
        private void Load(IReader reader)
        {
            reader.SeekTo(0);
            // Read the header
            var stringCount = reader.ReadInt32();  // int32 string count
            var dataSize = reader.ReadInt32();     // int32 string data size

            // Read string offsets
            var stringOffsets = new int[stringCount];
            for (var i = 0; i < stringCount; i++)
                stringOffsets[i] = reader.ReadInt32();

            // Seek to each offset and read each string
            var dataOffset = reader.BaseStream.Position;
            foreach (var offset in stringOffsets)
            {
                if (offset == -1 || offset >= dataSize)
                {
                    _strings.Add("");
                    continue;
                }
                reader.BaseStream.Position = dataOffset + offset;
                _strings.Add(reader.ReadAscii());
            }
        }
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:28,代码来源:FourthGenIndexedStringTable.cs

示例5: ThirdGenVersionInfo

        public ThirdGenVersionInfo(IReader reader)
        {
            reader.SeekTo(0x4);
            Version = reader.ReadInt32();

            reader.SeekTo(0x11C);
            BuildString = reader.ReadAscii();
        }
开发者ID:YxCREATURExY,项目名称:Assembly,代码行数:8,代码来源:ThirdGenVersionInfo.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: 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: ReadRequestedStrings

		public void ReadRequestedStrings(IReader reader, int tableOffset, CachedStringTable output)
		{
			int lastEnd = -1;
			foreach (int offset in _requestedStrings)
			{
				if (offset <= lastEnd)
					continue;

				reader.SeekTo(tableOffset + offset);
				string str = reader.ReadAscii();
				output.CacheString(offset, str);
				lastEnd = offset + str.Length;
			}
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:14,代码来源:StringTableReader.cs

示例9: ReadRequestedStrings

        public void ReadRequestedStrings(IReader reader, Pointer baseLocation, CachedStringTable output)
        {
            uint baseOffset = baseLocation.AsOffset();

            int lastEnd = -1;
            foreach (int offset in _requestedStrings)
            {
                if (offset <= lastEnd)
                    continue;
                reader.SeekTo(baseOffset + offset);
                string str = reader.ReadAscii();
                output.CacheString(offset, str);
                lastEnd = offset + str.Length;
            }
        }
开发者ID:YxCREATURExY,项目名称:Assembly,代码行数:15,代码来源:StringTableReader.cs

示例10: Load

        /// <summary>
        ///     Loads the strings into the StringTable
        /// </summary>
        private void Load(IReader reader)
        {
            reader.SeekTo(0);

            string csv = reader.ReadAscii();
            string[] strings = csv.Split(splitValues, StringSplitOptions.RemoveEmptyEntries);

            int count = strings.Length;
            for(int i=0;i<count;i+=2)
            {
                string[] s = strings[i].Split(splitValues2, StringSplitOptions.RemoveEmptyEntries);
                int index = Int32.Parse(s[s.Length-1], System.Globalization.NumberStyles.HexNumber);
                _strings.Add(index, strings[i + 1]);
            }
        }
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:18,代码来源:FourthGenCSVStringMap.cs

示例11: ReadDataBlock

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

			// Block data
			uint originalAddress = reader.ReadUInt32();
			int entryCount = (version >= 1) ? reader.ReadInt32() : 1;
			int align = (version >= 3) ? reader.ReadInt32() : 4;
			byte[] data = ReadByteArray(reader);
			var block = new DataBlock(originalAddress, entryCount, align, 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));
				}
			}

			if (version >= 4)
			{
				// Shader fixups
				int numShaderFixups = reader.ReadInt32();
				for (int i = 0; i < numShaderFixups; i++)
				{
					int writeOffset = reader.ReadInt32();
					int shaderDataSize = reader.ReadInt32();
					byte[] shaderData = reader.ReadBlock(shaderDataSize);
					block.ShaderFixups.Add(new DataBlockShaderFixup(writeOffset, shaderData));
				}
			}

			if (version >= 5)
			{
				// Unicode string list fixups
				int numUnicListFixups = reader.ReadInt32();
				for (int i = 0; i < numUnicListFixups; i++)
				{
					// Version 5 is buggy and doesn't include a language index :x
					int languageIndex = i;
					if (version >= 6)
						languageIndex = reader.ReadInt32();

					int writeOffset = reader.ReadInt32();
					int numStrings = reader.ReadInt32();
					UnicListFixupString[] strings = new UnicListFixupString[numStrings];
					for (int j = 0; j < numStrings; j++)
					{
						string stringId = reader.ReadAscii();
						string str = reader.ReadUTF8();
						strings[j] = new UnicListFixupString(stringId, str);
					}
					block.UnicListFixups.Add(new DataBlockUnicListFixup(languageIndex, writeOffset, strings));
				}
			}

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

示例12: ValidateFilm

        private void ValidateFilm(IReader reader)
        {
            // Validate Header Magic
            reader.SeekTo(0x00);
            var test = reader.ReadAscii();
            if (test != "_blf")
            {
                reader.Close();
                throw new NotSupportedException("Unsupported file.");
            }

            // Validate Header Type
            reader.SeekTo(0x0E);
            test = reader.ReadAscii();
            if (test != "reach saved film")
            {
                reader.Close();
                throw new NotSupportedException("Unsupported file.");
            }

            // Validate BLF Film Chunk Header
            reader.SeekTo(0x340);
            test = reader.ReadAscii();
            if (test != "flmh")
            {
                reader.Close();
                throw new NotSupportedException("Unsupported file.");
            }
        }
开发者ID:0xdeafcafe,项目名称:vintage,代码行数:29,代码来源:Halo4Film.cs

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

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

示例15: ReadTag

		private static ExtractedTag ReadTag(IReader reader, byte version)
		{
			if (version > 0)
				throw new InvalidOperationException("Unrecognized \"tag!\" block version");

			var datum = new DatumIndex(reader.ReadUInt32());
			uint address = reader.ReadUInt32();
			int tagClass = reader.ReadInt32();
			string name = reader.ReadAscii();
			return new ExtractedTag(datum, address, tagClass, name);
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:11,代码来源:TagContainerReader.cs


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