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


C# Stream.AlignRead方法代码示例

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


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

示例1: Read

        public void Read(Stream input)
        {
            X360Reader reader = new X360Reader(input, Encoding.Default, true, true);
            int unknown1 = reader.ReadInt32();
            int hashCount = reader.ReadInt32();
            int folderCount = reader.ReadInt32();
            int fileCount = reader.ReadInt32();
            int unknown2 = reader.ReadInt32();
            int unknown3 = reader.ReadInt32();
            int unknown4 = reader.ReadInt32();
            int unknown5 = reader.ReadInt32();
            for (int i = 0; i < hashCount; i++)
            {
                _hashes.Add(FileHash.ReadFileHash(input));
            }
            input.AlignRead(16);
            for (int i = 0; i < hashCount; i++)
            {
                _folderInfos.Add(FolderInfo.ReadFolderInfo(input));
            }
            input.AlignRead(16);
            for (int i = 0; i < folderCount; i++)
            {
                _folderStringIndices.Add(StringIndex.ReadStringIndex(input));
            }
            input.AlignRead(16);
            for (int i = 0; i < fileCount; i++)
            {
                _fileStringIndices.Add(StringIndex.ReadStringIndex(input));
            }
            input.AlignRead(16);

            long stringTableOffset = input.Position;
            foreach (var folderStringIndex in _folderStringIndices)
            {
                input.Position = stringTableOffset + folderStringIndex.Offset;
                string folderName = reader.ReadNullTerminatedString();
                _folderNames.Add(folderName);
            }
            foreach (var fileStringIndex in _fileStringIndices)
            {
                input.Position = stringTableOffset + fileStringIndex.Offset;
                string fileName = reader.ReadNullTerminatedString();
                _fileNames.Add(fileName);
            }
        }
开发者ID:emoose,项目名称:GzsTool,代码行数:46,代码来源:PathIdFile.cs

示例2: Read

        public void Read(Stream inputStream)
        {
            BinaryReader reader = new BinaryReader(inputStream, Encoding.Default, true);
            string magicNumber = reader.ReadString(4);
            short endianess = reader.ReadInt16();
            byte entryCount = reader.ReadByte();
            reader.Skip(1);
            short headerSize = reader.ReadInt16();
            inputStream.AlignRead(16);
            List<FfntEntryHeader> ffntEntryHeaders = new List<FfntEntryHeader>();

            for (int i = 0; i < entryCount; i++)
            {
                ffntEntryHeaders.Add(FfntEntryHeader.ReadFfntEntryHeader(inputStream));
            }

            foreach (var header in ffntEntryHeaders)
            {
                Entries.Add(header.ReadData(inputStream));
            }
        }
开发者ID:kkkkyue,项目名称:FoxEngine.TranslationTool,代码行数:21,代码来源:FfntFile.cs


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