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


C# BinaryReaderEx.ReadInt16方法代码示例

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


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

示例1: LoadSection

        public override void LoadSection(BinaryReaderEx reader)
        {
            base.LoadSection(reader);

            this.MotionInfoBlocks = new List<MotionInfoBlock>();
            int numMIBs = (this.SectionLength - 4) / bytesPerBlock;
            for (var i = 0; i < numMIBs; i++)
            {
                var mib = new MotionInfoBlock();
                mib.MotionName = reader.ReadFixedLengthString(16).Trim();
                mib.FrameCount = reader.ReadSByte();
                mib.CurveCoefficient = reader.ReadSByte();
                mib.InitialVelocity = reader.ReadSByte();
                mib.RollingFrameEnd = reader.ReadSByte();
                mib.CaseOfRightFootEnd = reader.ReadSByte();
                mib.CaseOfLeftFootEnd = reader.ReadSByte();
                mib.Unk1 = reader.ReadSByte();
                mib.Unk2 = reader.ReadSByte();
                mib.SubstituteMotionName = reader.ReadFixedLengthString(16).Trim();
                mib.SubstituteMotionStartFrame = reader.ReadSByte();
                mib.IdleFramesToBlend = reader.ReadSByte();
                mib.FrameStartingRotationStop = reader.ReadSByte();
                mib.EndsOnWhichFoot = reader.ReadSByte();
                mib.Unknown = reader.ReadInt16();

                this.MotionInfoBlocks.Add(mib);
            }
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:28,代码来源:CibmSection.cs

示例2: 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();
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:16,代码来源:SscfSection.cs

示例3: LoadSection

        public override void LoadSection(BinaryReaderEx reader)
        {
            base.LoadSection(reader);

            for (var i = 0; i < this.NumChildren; i++)
            {
                StringEntry entry = new StringEntry()
                {
                    StringIndex = reader.ReadInt16(),
                    Value = reader.ReadInt16(),
                    Parent = this
                };

                entry.DisplayName = entry.StringIndex.ToString();
                this.Children.Add(entry);
            }
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:17,代码来源:McbSection.cs

示例4: 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);
            }
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:26,代码来源:AdpcmWave.cs

示例5: 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);
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:39,代码来源:ShapChunk.cs

示例6: Load

        public override void Load(BinaryReaderEx reader)
        {
            BasePosition = reader.BaseStream.Position;
            Type = reader.ReadInt16();
            Unk1 = reader.ReadInt16();
            Unk2 = reader.ReadInt16();
            NumOffsets = reader.ReadInt16();
            StringTableOffset = reader.ReadInt32();

            for (var i = 0; i < NumOffsets; i++)
            {
                Offsets.Add(reader.ReadInt32());
            }

            if (StringTableOffset != 0)
            {
                reader.BaseStream.Position = BasePosition + StringTableOffset;
                StringTableBase = BasePosition + StringTableOffset;
                NumStrings = reader.ReadInt32();

                for (var i = 0; i < NumStrings; i++)
                {
                    StringOffsets.Add(reader.ReadInt32());
                }

                for (var i = 0; i < NumStrings; i++)
                {
                    reader.BaseStream.Position = StringTableBase + StringOffsets[i] + 4;
                    Strings.Add(reader.ReadNullTerminatedString());
                }
            }

            for (var i = 0; i < NumOffsets; i++)
            {
                reader.BaseStream.Position = BasePosition + this.Offsets[i];
                short type = reader.ReadInt16();
                SparkleChunkBase c;
                switch (type)
                {
                    case 1:
                        c = new SparkleChunk1();
                        break;
                    case 2:
                        c = new SparkleChunk2();
                        break;
                    case 3:
                        c = new SparkleChunk3();
                        break;
                    default:
                        throw new InvalidOperationException("Unexpected Sparkle Chunk Type: " + type);
                }

                reader.BaseStream.Position = BasePosition + this.Offsets[i];
                c.Load(reader);
                this.Chunks.Add(c);
            }
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:57,代码来源:SparkleFile.cs

示例7: Load

        public override void Load(BinaryReaderEx reader)
        {
            base.Load(reader);

            SectionLength = reader.ReadInt32(Endianness.BigEndian);
            reader.BaseStream.Seek(12, System.IO.SeekOrigin.Current);

            SpuBasePosition = reader.BaseStream.Position;

            NumSections = reader.ReadInt16();
            NumBones = reader.ReadInt16();

            reader.BaseStream.Seek(12, System.IO.SeekOrigin.Current);

            this.Sections = new List<SpuSectionData>();
            for (var i = 0; i < NumSections; i++)
            {
                SpuSectionData sectionData = new SpuSectionData();
                sectionData.Parent = this;
                this.Sections.Add(sectionData);
                this.Children.Add(sectionData);
                sectionData.Load(reader, i);
            }

            for (var i = 0; i < NumSections; i++)
            {
                var section = this.Sections[i];
                reader.BaseStream.Position = SpuBasePosition + section.Offset;
                section.LoadChunks(reader);
            }

            SpuCurveLoader.LoadCurves(reader, this);
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:33,代码来源:MtbSection.cs

示例8: LoadSection

        public override void LoadSection(BinaryReaderEx reader)
        {
            base.LoadSection(reader);

            this.NumEntries = reader.ReadInt16(Endianness.BigEndian);
            this.EntryLength = reader.ReadInt16(Endianness.BigEndian);
            this.ValuesPerEntry = reader.ReadInt16(Endianness.BigEndian);

            this.EquipParams = new List<EquipParam>(this.NumEntries);
            this.ValueLengths = new byte[this.ValuesPerEntry];

            for (var i = 0; i < this.ValuesPerEntry; i++)
            {
                this.ValueLengths[i] = reader.ReadByte();
            }

            for (var p = 0; p < this.NumEntries; p++)
            {
                var param = new EquipParam();
                param.ID = p + 1;
                var paramData = reader.ReadBytes(this.EntryLength);
                int offset = 0;
                byte thisByte = paramData[offset];
                int bitCnt = 8;
                for (var v = 0; v < this.ValuesPerEntry; v++)
                {
                    int thisLen = this.ValueLengths[v];
                    int val = 0;
                    do
                    {
                        val <<= 1;
                        if ((thisByte & 0x80) != 0)
                        {
                            val |= 1;
                        }
                        thisByte <<= 1;
                        bitCnt--;
                        if (bitCnt == 0)
                        {
                            offset++;
                            thisByte = paramData[offset];
                            bitCnt = 8;
                        }
                        thisLen--;
                    } while (thisLen != 0);
                    param.Values[v] = val;
                }
                this.EquipParams.Add(param);
            }
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:50,代码来源:EquipParamSection.cs

示例9: LoadCurves

        public static void LoadCurves(BinaryReaderEx reader, SpuBinary spuBinary)
        {
            var numBones = spuBinary.NumBones;

            foreach (var section in spuBinary.Sections)
            {
                var bones = CreateBoneArray(numBones);

                foreach (var chunk in section.Chunks)
                {
                    reader.BaseStream.Position = spuBinary.SpuBasePosition + chunk.Offset;

                    for (var i = 0; i < chunk.NumChildren; i++)
                    {
                        var boneId = reader.ReadInt16(Endianness.BigEndian);
                        var type = reader.ReadInt16(Endianness.BigEndian);
                        var count = reader.ReadInt16(Endianness.BigEndian);
                        reader.ReadInt16(); // Skip 2 unused bytes

                        if ((type == 0 && chunk.Flag != 1) || (type != 0 && chunk.Flag == 1))
                        {
                            throw new InvalidOperationException(String.Format("Flag/Type mismatch? Flag = {0} Type = {1}", chunk.Flag, type));
                        }

                        AnimatedComponent component = DetermineAnimatedComponent(type);

                        Curves.CurveBase curve;
                        switch (type)
                        {
                            case 0x00:
                                curve = CreateQuaternionCurve(reader, count);
                                break;
                            case 0x04:
                            case 0x05:
                            case 0x06:
                            case 0x07:
                            case 0x08:
                            case 0x09:
                                curve = CreateCompressedLinearCurve(reader, component, count);
                                break;
                            case 0x0B:
                            case 0x0C:
                            case 0x0D:
                            case 0x0E:
                            case 0x0F:
                            case 0x10:
                                curve = CreateConstantCurve(reader, component, count);
                                break;
                            case 0x11:
                            case 0x12:
                            case 0x13:
                                curve = CreateUncompressedLinearCurve(reader, component, count);
                                break;
                            default:
                                throw new InvalidOperationException("Unknown curve type " + type);
                        }

                        if (curve.CurveValues.Count == 0) { throw new InvalidOperationException("No Curve Values!?"); }
                        AddCurveToBone(bones, boneId, curve);
                    }
                }

                for (var i = 0; i < numBones; i++)
                {
                    var bone = bones[i];
                    if (bone == null) { continue; }

                    var boneNode = new AnimatedBoneNode();
                    boneNode.Bone = bone;
                    boneNode.Parent = section;
                    section.Children.Add(boneNode);
                }
            }
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:74,代码来源:SpuCurveLoader.cs

示例10: ShortToFloat

 private static float ShortToFloat(BinaryReaderEx src)
 {
     short val = src.ReadInt16(Endianness.BigEndian);
     return val / 32768.0f;
 }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:5,代码来源:StreamDecompressors.cs

示例11: ReadRst

        private void ReadRst(BinaryReaderEx reader)
        {
            long rstStart = reader.BaseStream.Position;

            rstChunk = new RstChunk();
            rstChunk.Parent = this;
            int magic = reader.ReadInt32();
            if (magic != 0x54535240) { throw new InvalidOperationException("Expecting @RST (0x54535240), Found " + magic.ToString("X")); }

            rstChunk.ChunkBlocks = reader.ReadInt16();
            rstChunk.NumResources = reader.ReadInt16();
            rstChunk.ResourceOffsets = new List<int>();
            for (var i = 0; i < rstChunk.NumResources; i++)
            {
                rstChunk.ResourceOffsets.Add(reader.ReadInt32());
            }

            this.Children.Add(rstChunk);

            int rstLen = rstChunk.ChunkBlocks * 8;
            long rstOffset = rstStart + rstLen;

            ReadResources(reader, rstOffset);
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:24,代码来源:McbSection.cs

示例12: ReadResources

        private void ReadResources(BinaryReaderEx reader, long rstOffset)
        {
            for (var i = 0; i < this.rstChunk.ResourceOffsets.Count; i++)
            {
                long offset = rstOffset + this.rstChunk.ResourceOffsets[i];
                reader.BaseStream.Position = offset;

                ResHeader resHeader = new ResHeader();
                int magic = reader.ReadInt32();

                if (magic != 0x53455240)
                {
                    throw new InvalidOperationException("Expected @RST (0x53455240), found " + magic.ToString("X"));
                }

                resHeader.ChunkBlocks = reader.ReadInt16();
                resHeader.Unknown1 = reader.ReadInt16();
                resHeader.ResType = reader.ReadFixedLengthString(8).TrimEnd('\0');
                resHeader.Unknown2 = reader.ReadInt32();
                resHeader.Unknown3 = reader.ReadInt32();

                McbResource resource;
                switch (resHeader.ResType)
                {
                    case "String":
                        resource = new McbStrings(resHeader);
                        break;
                    case "motionC":
                        resource = new McbMotionC(resHeader);
                        break;
                    case "RIDTBL":
                    case "Effect":
                    case "ClipGid":
                        resource = new McbResource(resHeader);
                        break;
                    default:
                        throw new InvalidOperationException("Unknown Mcb Resource: " + resHeader.ResType);
                }
                resource.Parent = this;
                resource.LoadSection(reader);
                this.Children.Add(resource);
            }

            var strings = this.GetChildOfType<McbStrings>();
            var stringEntries = this.FindAllChildren<StringEntry>();
            foreach (var entry in stringEntries)
            {
                entry.DisplayName = strings.Strings[entry.StringIndex];
            }
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:50,代码来源:McbSection.cs

示例13: LoadFile

        public void LoadFile(BinaryReaderEx reader)
        {
            BasePosition = reader.BaseStream.Position;

            reader.ReadInt32();
            Unknown1 = reader.ReadInt16();
            NumOffsets = reader.ReadInt16();
            Unknown2 = reader.ReadInt16();
            Unknown3 = reader.ReadInt16();
            Unknown4 = reader.ReadInt16();
            NumFiles = reader.ReadInt16();
            Unknown5 = reader.ReadInt32();

            for (var i = 0; i < NumOffsets; i++)
            {
                this.Offsets.Add(reader.ReadInt32());
            }

            SparkleBlock b;
            for (var i = 0; i < NumOffsets; i++)
            {
                long offsetPos = BasePosition + this.Offsets[i];
                reader.BaseStream.Position = offsetPos;
                short type = reader.ReadInt16();
                switch (type)
                {
                    case 0:
                        b = new SparkleImageClip();
                        break;
                    case 1:
                        b = new SparkleType1();
                        break;
                    case 2:
                        b = new SparkleContainer();
                        break;
                    default:
                        throw new InvalidOperationException("Unexpected SparkleBlock Type: " + type);
                }

                reader.BaseStream.Position = offsetPos;
                b.Load(reader);
                this.Blocks.Add(b);
            }

            SparkleContainer fileContainer = this.Blocks[0] as SparkleContainer;
            if (fileContainer == null)
            {
                throw new InvalidOperationException("First sparkle block is not a container?");
            }

            SparkleImage img;
            for (var i = 0; i < NumFiles; i++)
            {
                img = new SparkleImage();
                img.Parent = this;

                if (i < fileContainer.Strings.Count)
                {
                    img.FileName = fileContainer.Strings[i];
                }

                SparkleChunkBase c = fileContainer.Chunks[i];
                if (c.Reference == 0)
                {
                    img.ImageClip = null;
                }
                else
                {
                    b = this.Blocks[c.Reference - 1];
                    int recursion = 0;
                    while (recursion < 5)
                    {
                        if (b is SparkleImageClip)
                        {
                            img.ImageClip = (SparkleImageClip)b;
                            break;
                        }
                        else if (b is SparkleType1)
                        {
                            img.ImageClip = null;
                            break;
                        }
                        else if (b is SparkleContainer)
                        {
                            SparkleContainer cont = (SparkleContainer)b;
                            if (cont.Chunks[0].Reference == 0)
                            {
                                img.ImageClip = null;
                                break;
                            }

                            b = this.Blocks[cont.Chunks[0].Reference - 1];
                        }
                        recursion++;
                    }
                }

                if (img.ImageClip != null)
                {
                    this.Children.Add(img);
//.........这里部分代码省略.........
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:101,代码来源:SparkleFile.cs

示例14: LoadSection

        public void LoadSection(BinaryReaderEx reader)
        {
            this.Header = new GtexHeader();
            this.Header.Magic = reader.ReadInt32();
            this.Header.Unknown1 = reader.ReadByte();
            this.Header.Unknown2 = reader.ReadByte();
            this.Header.Format = reader.ReadByte();
            this.Header.MipMapCount = reader.ReadByte();
            this.Header.Unknown3 = reader.ReadByte();
            this.Header.IsCubeMap = reader.ReadByte() == 0x1;
            this.Header.Width = reader.ReadUInt16(Endianness.BigEndian);
            this.Header.Height = reader.ReadUInt16(Endianness.BigEndian);
            this.Header.Depth = reader.ReadInt16(Endianness.BigEndian);
            this.Header.Unknown5 = reader.ReadInt32(Endianness.BigEndian);
            this.Header.DataOffset = reader.ReadUInt32(Endianness.BigEndian);

            if (this.Header.IsCubeMap) { this.NumLayers = 6; }
            else { this.NumLayers = this.Header.MipMapCount; }

            this.LoadMipMapData(reader);
            this.GetDataOffset();
            this.LoadTextureData(reader);
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:23,代码来源:GtexData.cs

示例15: LoadSection

        public override void LoadSection(BinaryReaderEx reader)
        {
            base.LoadSection(reader);

            this.VtexHeader = new VtexHeader();
            this.VtexHeader.Unknown1 = reader.ReadInt32();
            this.VtexHeader.DataLength = reader.ReadInt32();
            this.VtexHeader.Unknown2 = reader.ReadInt16();
            this.VtexHeader.Unknown3 = reader.ReadInt16();
            this.VtexHeader.Unknown4 = reader.ReadInt16();
            this.VtexHeader.Unknown5 = reader.ReadInt16();
            this.VtexHeader.Unknown6 = reader.ReadInt32();
            this.VtexHeader.Unknown7 = reader.ReadInt32();
            this.VtexHeader.Unknown8 = reader.ReadInt32();
            this.VtexHeader.Unknown9 = reader.ReadInt32();
            this.VtexHeader.Unknown10 = reader.ReadInt32();
            this.VtexHeader.Unknown11 = reader.ReadInt32();
            this.VtexHeader.Unknown12 = reader.ReadInt32();
            this.VtexHeader.Unknown13 = reader.ReadInt32();
            this.VtexHeader.Unknown14 = reader.ReadInt32();
            this.VtexHeader.Unknown15 = reader.ReadInt32();
            this.VtexHeader.Unknown16 = reader.ReadInt32();
            this.VtexHeader.Name = reader.ReadFixedLengthString(16).TrimEnd('\0');
            this.VtexHeader.Extension = reader.ReadFixedLengthString(8).TrimEnd('\0');
            this.VtexHeader.Unknown17 = reader.ReadInt32();
            this.VtexHeader.GtexOffset = reader.ReadInt32();
            this.VtexHeader.Unknown18 = reader.ReadInt32();
            this.VtexHeader.Unknown19 = reader.ReadInt32();

            reader.BaseStream.Position = this.SectionStart + 0x30 + this.VtexHeader.GtexOffset;

            // Load GTEX
            Gtex = new GtexData();
            Gtex.Parent = this;
            Gtex.LoadSection(reader);

            this.Children = new List<INavigable>();
            this.Children.Add(this.Gtex);
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:39,代码来源:VtexSection.cs


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