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


C# Stream.ReadASCIIZ方法代码示例

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


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

示例1: Deserialize

		public void Deserialize(Stream stream)
		{
			List<PackageEntry> entries = new List<PackageEntry>();

			// Types
			while (true)
			{
				string typeName = stream.ReadASCIIZ();
				if (typeName == "")
				{
					break;
				}

				// Directories
				while (true)
				{
					string directoryName = stream.ReadASCIIZ();
					if (directoryName == "")
					{
						break;
					}

					// Files
					while (true)
					{
						string fileName = stream.ReadASCIIZ();
						if (fileName == "")
						{
							break;
						}

						PackageEntry entry = new PackageEntry();
						entry.FileName = fileName;
						entry.DirectoryName = directoryName.Replace("/", "\\");
						entry.TypeName = typeName;
						entry.HashOrTimestamp = stream.ReadU32();
						entry.SmallData = new byte[stream.ReadU16()];
						entry.ArchiveIndex = stream.ReadU16();
						entry.Offset = stream.ReadU32();
						entry.Size = stream.ReadU32();
						entry.Unknown = stream.ReadU16();

						if (entry.Unknown != 0xFFFF)
						{
							throw new PackageFileException();
						}

						if (entry.SmallData.Length > 0)
						{
							stream.Read(entry.SmallData, 0, entry.SmallData.Length);
						}

						entries.Add(entry);
					}
				}
			}

			this.Entries = entries;
		}
开发者ID:eanbowman,项目名称:Gibbed-VPK-Extractor-1.1-Fixed,代码行数:59,代码来源:PackageFile.cs

示例2: D2kSoundResources

		public D2kSoundResources(string filename, int priority)
		{
			this.filename = filename;
			this.priority = priority;

			s = GlobalFileSystem.Open(filename);
			try
			{
				filenames = new List<string>();

				var headerLength = s.ReadUInt32();
				while (s.Position < headerLength + 4)
				{
					var name = s.ReadASCIIZ();
					var offset = s.ReadUInt32();
					var length = s.ReadUInt32();

					var hash = PackageEntry.HashFilename(name, PackageHashType.Classic);
					if (!index.ContainsKey(hash))
						index.Add(hash, new PackageEntry(hash, offset, length));

					filenames.Add(name);
				}
			}
			catch
			{
				Dispose();
				throw;
			}
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:30,代码来源:D2kSoundResources.cs

示例3: PakFile

		public PakFile(string filename, int priority)
		{
			this.filename = filename;
			this.priority = priority;
			index = new Dictionary<string, Entry>();

			stream = GlobalFileSystem.Open(filename);
			try
			{
				index = new Dictionary<string, Entry>();
				var offset = stream.ReadUInt32();
				while (offset != 0)
				{
					var file = stream.ReadASCIIZ();
					var next = stream.ReadUInt32();
					var length = (next == 0 ? (uint)stream.Length : next) - offset;

					// Ignore duplicate files
					if (index.ContainsKey(file))
						continue;

					index.Add(file, new Entry { Offset = offset, Length = length, Filename = file });
					offset = next;
				}
			}
			catch
			{
				Dispose();
				throw;
			}
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:31,代码来源:Pak.cs

示例4: FileGroup

			public FileGroup(Stream reader, long offset)
			{
				var nameOffset = reader.ReadUInt32();
				/*   unknown  */ reader.ReadBytes(18);
				FirstFile = reader.ReadUInt32();
				LastFile = reader.ReadUInt32();

				reader.Seek(offset + (long)nameOffset, SeekOrigin.Begin);
				Name = reader.ReadASCIIZ();
			}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:10,代码来源:InstallShieldCABExtractor.cs

示例5: Entry

			public Entry(Stream s)
			{
				this.s = s;

				offset = s.ReadUInt32();
				size = s.ReadUInt32();
				if (BitConverter.IsLittleEndian)
				{
					offset = int2.Swap(offset);
					size = int2.Swap(size);
				}

				Path = s.ReadASCIIZ();
			}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:14,代码来源:BigFile.cs

示例6: FileDescriptor

			public FileDescriptor(Stream reader, long tableOffset)
			{
				Flags = reader.ReadUInt16();
				ExpandedSize = reader.ReadUInt32();
				/*    unknown   */ reader.ReadUInt32();
				CompressedSize = reader.ReadUInt32();

				/*  unknown */ reader.ReadUInt32();
				DataOffset   = reader.ReadUInt32();
				/*  unknown */ reader.ReadUInt32();
				MD5          = reader.ReadBytes(16);

				/*   unknown  */ reader.ReadBytes(16);
				NameOffset     = reader.ReadUInt32();
				DirectoryIndex = reader.ReadUInt16();
				/*   unknown  */ reader.ReadBytes(12);
				LinkToPrevious = reader.ReadUInt32();
				LinkToNext = reader.ReadUInt32();

				LinkFlags = reader.ReadBytes(1)[0];
				Volume = reader.ReadUInt16();
				var posSave = reader.Position;

				reader.Seek(tableOffset + NameOffset, SeekOrigin.Begin);
				Filename = reader.ReadASCIIZ();
				reader.Seek(posSave, SeekOrigin.Begin);
			}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:27,代码来源:InstallShieldCABExtractor.cs

示例7: FileGroup

            public FileGroup(Stream stream, long offset)
            {
                var nameOffset = stream.ReadUInt32();
                stream.Position += 18;
                FirstFile = stream.ReadUInt32();
                LastFile = stream.ReadUInt32();

                var pos = stream.Position;
                stream.Position = offset + nameOffset;
                Name = stream.ReadASCIIZ();
                stream.Position = pos;
            }
开发者ID:OpenRA,项目名称:OpenRA,代码行数:12,代码来源:InstallShieldCABCompression.cs

示例8: FileDescriptor

            public FileDescriptor(Stream stream, uint index, long tableOffset)
            {
                Index = index;
                Flags = (CABFlags)stream.ReadUInt16();
                ExpandedSize = stream.ReadUInt32();
                stream.Position += 4;
                CompressedSize = stream.ReadUInt32();

                stream.Position += 4;
                DataOffset = stream.ReadUInt32();
                stream.Position += 4;
                MD5 = stream.ReadBytes(16);

                stream.Position += 16;
                NameOffset = stream.ReadUInt32();
                DirectoryIndex = stream.ReadUInt16();
                stream.Position += 12;
                LinkToPrevious = stream.ReadUInt32();
                LinkToNext = stream.ReadUInt32();

                LinkFlags = (LinkFlags)stream.ReadUInt8();
                Volume = stream.ReadUInt16();

                var pos = stream.Position;
                stream.Position = tableOffset + NameOffset;
                Filename = stream.ReadASCIIZ();
                stream.Position = pos;
            }
开发者ID:OpenRA,项目名称:OpenRA,代码行数:28,代码来源:InstallShieldCABCompression.cs

示例9: DirectoryDescriptor

            public DirectoryDescriptor(Stream stream, long nameTableOffset)
            {
                var nameOffset = stream.ReadUInt32();
                var pos = stream.Position;

                stream.Position = nameTableOffset + nameOffset;

                Name = stream.ReadASCIIZ();
                stream.Position = pos;
            }
开发者ID:OpenRA,项目名称:OpenRA,代码行数:10,代码来源:InstallShieldCABCompression.cs

示例10: CabFile

 public CabFile(Stream stream)
 {
     DecompressedLength = stream.ReadUInt32();
     DecompressedOffset = stream.ReadUInt32();
     FolderIndex = stream.ReadUInt16();
     stream.Position += 6;
     FileName = stream.ReadASCIIZ();
 }
开发者ID:pchote,项目名称:OpenRA,代码行数:8,代码来源:MSCabCompression.cs


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