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


C# IReader.ReadUTF8方法代码示例

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


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

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

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

示例3: ReadLocaleChanges

		private static void ReadLocaleChanges(IReader reader, Patch output)
		{
			// Read language changes
			byte numLanguageChanges = reader.ReadByte();
			for (byte i = 0; i < numLanguageChanges; i++)
			{
				byte languageIndex = reader.ReadByte();
				var languageChange = new LanguageChange(languageIndex);

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

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


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