本文整理汇总了C#中BinaryReaderEx.ReadInt32方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryReaderEx.ReadInt32方法的具体用法?C# BinaryReaderEx.ReadInt32怎么用?C# BinaryReaderEx.ReadInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryReaderEx
的用法示例。
在下文中一共展示了BinaryReaderEx.ReadInt32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadHeader
private void ReadHeader(BinaryReaderEx reader)
{
this.Header = new DatDigger.Sound.AdpcmWaveFormat();
this.Header.FormatTag = (SlimDX.Multimedia.WaveFormatTag)reader.ReadInt16();
this.Header.Channels = reader.ReadInt16();
this.Header.SamplesPerSecond = reader.ReadInt32();
this.Header.AverageBytesPerSecond = reader.ReadInt32();
this.Header.BlockAlignment = reader.ReadInt16();
this.Header.BitsPerSample = reader.ReadInt16();
short cbSize = reader.ReadInt16();
if (cbSize != 0x20)
{
throw new InvalidOperationException(String.Format("Unexpected value for ADPCMWAVEFORMAT cbSize 0x{0}. Expected 0x20", cbSize));
}
this.Header.SamplesPerBlock = reader.ReadInt16();
this.Header.NumCoef = reader.ReadInt16();
this.Header.Coefficients = new List<DatDigger.Sound.AdpcmCoefficient>(this.Header.NumCoef);
for (var i = 0; i < this.Header.NumCoef; i++)
{
DatDigger.Sound.AdpcmCoefficient coef = new DatDigger.Sound.AdpcmCoefficient();
coef.A = reader.ReadInt16();
coef.B = reader.ReadInt16();
this.Header.Coefficients.Add(coef);
}
}
示例2: LoadData
public void LoadData(BinaryReaderEx reader)
{
reader.ReadInt32(); // Remove PWIB bytes
this.FileSize = reader.ReadUInt32(Endianness.BigEndian);
this.Unknown = reader.ReadInt32(Endianness.BigEndian);
this.DataOffset = reader.ReadUInt32(Endianness.BigEndian);
this.LoadSection(reader);
}
示例3: LoadData
public virtual void LoadData(BinaryReaderEx reader)
{
this.ChunkStart = reader.BaseStream.Position;
this.ChunkHeader = new ChunkHeader();
this.ChunkHeader.ChunkType = reader.ReadInt32();
this.ChunkHeader.Unknown1 = reader.ReadInt32(Endianness.BigEndian);
this.ChunkHeader.DataSize = reader.ReadInt32(Endianness.BigEndian);
this.ChunkHeader.NextChunkOffset = reader.ReadInt32(Endianness.BigEndian);
}
示例4: LoadSection
public virtual void LoadSection(BinaryReaderEx reader)
{
this.SectionStart = reader.BaseStream.Position;
this.SectionHeader = new SectionHeader();
this.SectionHeader.Magic = reader.ReadInt64();
this.SectionHeader.Version = reader.ReadInt32();
this.SectionHeader.Unknown2 = reader.ReadInt32();
this.SectionHeader.SectionLength = reader.ReadInt32();
this.SectionHeader.Junk = reader.ReadBytes(28);
}
示例5: LoadHeader
private void LoadHeader(BinaryReaderEx reader)
{
// Load Header
this.ResourceHeader = new ResourceHeader();
this.ResourceHeader.NumResources = reader.ReadInt32();
this.ResourceHeader.StringTableOffset = reader.ReadInt32();
this.ResourceHeader.NumStrings = reader.ReadInt32();
this.ResourceHeader.ResourceType = (SectionType)reader.ReadInt32();
this.LoadResourceInfo(reader);
}
示例6: LoadHeader
private void LoadHeader(BinaryReaderEx reader)
{
this.startHeaderOffset = reader.BaseStream.Position;
this.SscfHeader = new SscfHeader();
this.SscfHeader.Unknown0 = reader.ReadInt16();
this.SscfHeader.NumTracks = reader.ReadInt16();
this.SscfHeader.NumWaves = reader.ReadInt16();
this.SscfHeader.Unknown1 = reader.ReadInt16();
this.SscfHeader.OffsetA = reader.ReadInt32();
this.SscfHeader.OffsetB = reader.ReadInt32();
this.SscfHeader.OffsetC = reader.ReadInt64();
this.SscfHeader.OffsetD = reader.ReadInt64();
this.SscfHeader.OffsetE = reader.ReadInt64();
this.SscfHeader.Unused = reader.ReadInt64();
}
示例7: LoadSection
public override void LoadSection(BinaryReaderEx reader)
{
base.LoadSection(reader);
this.TextureHeader = new TextureHeader();
this.TextureHeader.Unknown1 = reader.ReadInt32();
this.TextureHeader.Unknown2 = reader.ReadInt32();
this.TextureHeader.Unknown3 = reader.ReadInt32();
this.TextureHeader.Unknown4 = reader.ReadInt32();
// Load GTEX
Gtex = new GtexData();
Gtex.Parent = this;
Gtex.LoadSection(reader);
this.Children = new List<INavigable>();
this.Children.Add(this.Gtex);
}
示例8: LoadSection
public override void LoadSection(BinaryReaderEx reader)
{
base.LoadSection(reader);
this.NumElements = reader.ReadInt32();
reader.BaseStream.Seek(12, System.IO.SeekOrigin.Current); // Skip 12 bytes
this.ElementOffsets = new List<ElementOffsetData>();
for (var i = 0; i < this.NumElements; i++)
{
var thing = new ElementOffsetData();
thing.BoneNameOffset = reader.ReadInt32();
thing.NameOffset = reader.ReadInt32();
thing.OffsetX = reader.ReadSingle();
thing.OffsetY = reader.ReadSingle();
thing.OffsetZ = reader.ReadSingle();
thing.Unused1 = reader.ReadInt32();
thing.Unused2 = reader.ReadInt32();
thing.Unused3 = reader.ReadInt32();
this.ElementOffsets.Add(thing);
}
foreach (var el in this.ElementOffsets)
{
reader.BaseStream.Position = this.SectionStart + el.BoneNameOffset;
el.BoneName = reader.ReadNullTerminatedString();
reader.BaseStream.Position = this.SectionStart + el.NameOffset;
el.Name = reader.ReadNullTerminatedString();
}
}
示例9: LoadFile
public void LoadFile(BinaryReaderEx reader)
{
reader.BaseStream.Position = 4;
this.Unknown = reader.ReadInt32();
this.ContentLength = reader.ReadInt32();
this.IsEncoded = (reader.ReadByte() == 0xFF);
byte[] data = new byte[this.ContentLength];
reader.Read(data, 0, this.ContentLength);
if (this.IsEncoded)
{
for (var i = 0; i < data.Length; i++)
{
data[i] ^= 0x73;
}
}
this.Data = data;
this.DataAsString = Encoding.UTF8.GetString(data);
}
示例10: LoadBones
private void LoadBones(BinaryReaderEx reader)
{
reader.BaseStream.Position = this.BasePosition;
this.Bones = new List<Skeleton.SkeletonBone>(this.BoneCount);
this.Children = new List<INavigable>(this.BoneCount);
for (var i = 0; i < this.BoneCount; i++)
{
Skeleton.SkeletonBone bone = new Skeleton.SkeletonBone();
bone.Parent = this;
bone.StringIndex = reader.ReadInt32();
bone.Unknown1 = reader.ReadInt32();
bone.Unknown2 = reader.ReadInt32();
bone.Unknown3 = reader.ReadInt32();
bone.Translation.X = reader.ReadSingle();
bone.Translation.Y = reader.ReadSingle();
bone.Translation.Z = reader.ReadSingle();
bone.Rotation.X = reader.ReadSingle();
bone.Rotation.Y = reader.ReadSingle();
bone.Rotation.Z = reader.ReadSingle();
bone.Rotation.W = reader.ReadSingle();
bone.Scale.X = reader.ReadSingle();
bone.Scale.Y = reader.ReadSingle();
bone.Scale.Z = reader.ReadSingle();
bone.ParentBoneIndex = reader.ReadInt32();
bone.ChildBoneIndex = reader.ReadInt32();
bone.SiblingBoneIndex = reader.ReadInt32();
bone.BoneIndex = reader.ReadInt32();
bone.Unknown4 = reader.ReadInt32();
bone.Unknown5 = reader.ReadInt32();
bone.Stuff = reader.ReadBytes(96);
this.Bones.Add(bone);
this.Children.Add(bone);
bone.Name = this.StringTable[bone.StringIndex];
}
}
示例11: LoadData
public override void LoadData(BinaryReaderEx reader)
{
base.LoadData(reader);
long pos = reader.BaseStream.Position;
this.BlockSize = reader.ReadInt32(Endianness.BigEndian);
this.StringOffset = reader.ReadInt32(Endianness.BigEndian);
this.ShaderOffset = reader.ReadInt32(Endianness.BigEndian);
this.Name = reader.ReadNullTerminatedString();
reader.BaseStream.Position = pos + this.ShaderOffset;
this.UnknownData = reader.ReadBytes(16);
this.CompiledShaderLength = reader.ReadInt32(Endianness.BigEndian);
this.Unknown4 = reader.ReadInt32(Endianness.BigEndian);
reader.BaseStream.Position = pos + this.ShaderOffset + 0x20;
this.CompiledShader = reader.ReadBytes(this.CompiledShaderLength);
this.DisplayName = String.Format("File [0x{0:X}]", this.ChunkStart);
}
示例12: LoadVoices
private void LoadVoices(BinaryReaderEx reader)
{
if (this.SscfHeader.NumWaves <= 0)
{
return;
}
reader.BaseStream.Position = this.SscfHeader.OffsetB;
this.VoiceOffsets = new List<int>(this.SscfHeader.NumWaves);
this.Children = new List<INavigable>(this.SscfHeader.NumWaves);
for (var i = 0; i < this.SscfHeader.NumWaves; i++)
{
this.VoiceOffsets.Add(reader.ReadInt32());
}
foreach (int offset in this.VoiceOffsets)
{
reader.BaseStream.Position = offset;
WaveHeader waveHeader = ReadWaveHeader(reader);
IWave voice = null;
switch (waveHeader.Format)
{
case WaveCompressionFormat.PCM:
voice = new PcmWave() { Parent = this, WaveHeader = waveHeader };
break;
case WaveCompressionFormat.Vorbis:
voice = new VorbisWave() { Parent = this, WaveHeader = waveHeader };
break;
case WaveCompressionFormat.ADPCM:
voice = new AdpcmWave() { Parent = this, WaveHeader = waveHeader };
break;
case WaveCompressionFormat.ATRAC3:
case WaveCompressionFormat.ATRAC3_Too:
case WaveCompressionFormat.XMA:
throw new InvalidOperationException("Unsupported Wave Format: " + waveHeader.Format);
default:
throw new InvalidOperationException("Unknown Wave Format: 0x" + ((int)waveHeader.Format).ToString("X"));
}
this.Children.Add(voice);
voice.LoadData(reader);
}
}
示例13: LoadData
public override void LoadData(BinaryReaderEx reader)
{
base.LoadData(reader);
this.DisplayName = "Header";
this.Unknown0 = reader.ReadByte();
this.PgrpCount = reader.ReadByte();
this.StmsCount = reader.ReadByte();
this.EnvdCount = reader.ReadByte();
this.Unknown1 = reader.ReadInt32(Endianness.BigEndian);
this.Unknown2 = reader.ReadByte();
this.Unknown3 = reader.ReadByte();
this.Unknown4 = reader.ReadByte();
this.Unknown5 = reader.ReadByte();
this.ShapCount = reader.ReadByte();
this.MimsCount = reader.ReadByte();
this.Unknown6 = reader.ReadByte();
this.Unknown7 = reader.ReadByte();
}
示例14: LoadData
public override void LoadData(BinaryReaderEx reader)
{
base.LoadData(reader);
shapOffset = reader.BaseStream.Position;
this.ShapHeader = new ShapHeader();
this.ShapHeader.NumThings = reader.ReadInt32(Endianness.BigEndian);
this.ShapHeader.ThingOffset = reader.ReadInt32(Endianness.BigEndian);
this.ShapHeader.NumThings2 = reader.ReadInt32(Endianness.BigEndian);
this.ShapHeader.Thing2Offset = reader.ReadInt32(Endianness.BigEndian);
this.ShapHeader.NameOffset = reader.ReadInt32(Endianness.BigEndian);
this.ShapHeader.Unknown = reader.ReadInt32(Endianness.BigEndian);
reader.BaseStream.Position = shapOffset + this.ShapHeader.ThingOffset;
this.Things = new List<ShapThing1>();
for (var i = 0; i < this.ShapHeader.NumThings; i++)
{
ShapThing1 t = new ShapThing1();
t.Unk1 = reader.ReadInt16(Endianness.BigEndian);
t.Unk2 = reader.ReadInt16(Endianness.BigEndian);
this.Things.Add(t);
}
reader.BaseStream.Position = shapOffset + this.ShapHeader.Thing2Offset;
this.Things2 = new List<ShapThing2>();
for (var j = 0; j < this.ShapHeader.NumThings2; j++)
{
ShapThing2 t = new ShapThing2();
t.Unk1 = reader.ReadSingle(Endianness.BigEndian);
t.Unk2 = reader.ReadSingle(Endianness.BigEndian);
t.Unk3 = reader.ReadSingle(Endianness.BigEndian);
this.Things2.Add(t);
}
reader.BaseStream.Position = shapOffset + this.ShapHeader.NameOffset;
this.Name = reader.ReadNullTerminatedString();
this.DisplayName = String.Format("SHAP [{0}]", this.Name);
}
示例15: Load
public override void Load(BinaryReaderEx reader)
{
Type = reader.ReadInt16();
Unk1 = reader.ReadInt16();
Unk2 = reader.ReadInt32();
Float1 = reader.ReadSingle();
Float2 = reader.ReadSingle();
Float3 = reader.ReadSingle();
Float4 = reader.ReadSingle();
Float5 = reader.ReadSingle();
Float6 = reader.ReadSingle();
}