本文整理汇总了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);
}
}
示例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));
}
}