• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# BinaryReaderEx类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

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


示例2: 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


示例3: LoadData

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

            this.String = reader.ReadNullTerminatedString(Encoding.ASCII);
            this.DisplayName = "STR";
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:7,代码来源:StringChunk.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: LoadSection

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

            this.baseChunk = ChunkLoader.LoadChunk(SectionType.wrb, reader, this);
            this.Children = new List<INavigable>();
            this.Children.Add(baseChunk);
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:8,代码来源:ModelSection.cs


示例6: LoadSection

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

            this.LoadHeader(reader);
            this.LoadStringTable(reader);
            this.LoadBones(reader);
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:8,代码来源:SkeletonSection.cs


示例7: LoadFile

        public void LoadFile(BinaryReaderEx reader)
        {
            reader.BaseStream.Seek(8, System.IO.SeekOrigin.Begin);

            this.ReadEncodedData(reader);
            this.DecodeData();

            this.Contents = Encoding.UTF8.GetString(this.decodedData);
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:9,代码来源:SqexFile.cs


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


示例9: LoadData

        public void LoadData(BinaryReaderEx reader)
        {
            long pos = reader.BaseStream.Position;

            BuildFormat();

            reader.BaseStream.Position = pos + this.WaveHeader.FormatHeaderLength;
            this.WaveData = reader.ReadBytes(this.WaveHeader.DataLength);
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:9,代码来源:PcmWave.cs


示例10: LoadSection

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

            this.LoadHeader(reader);
            this.LoadResourceTypes(reader);
            this.LoadResourceIds(reader);
            this.LoadStringTable(reader);
            this.LoadResources(reader);
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:10,代码来源:ResourceSection.cs


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


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


示例13: LoadSection

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

            this.Strings = new List<string>();
            int numStrings = (this.SectionLength - 4) / bytesPerBlock;
            for (var i = 0; i < numStrings; i++)
            {
                this.Strings.Add(reader.ReadFixedLengthString(16).Trim());
            }
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:11,代码来源:CibcSection.cs


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


示例15: LoadData

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

            this.boundingBox.Minimum.X = reader.ReadSingle(Endianness.BigEndian);
            this.boundingBox.Minimum.Y = reader.ReadSingle(Endianness.BigEndian);
            this.boundingBox.Minimum.Z = reader.ReadSingle(Endianness.BigEndian);
            this.boundingBox.Maximum.X = reader.ReadSingle(Endianness.BigEndian);
            this.boundingBox.Maximum.Y = reader.ReadSingle(Endianness.BigEndian);
            this.boundingBox.Maximum.Z = reader.ReadSingle(Endianness.BigEndian);

            this.DisplayName = "AABB";
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:13,代码来源:BoundingBoxChunk.cs


示例16: 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


示例17: LoadSection

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

            this.CibtData = new List<CibtData>();
            int numCibtBlocks = (this.SectionLength - 4) / bytesPerBlock;
            for (var i = 0; i < numCibtBlocks; i++)
            {
                var cibt = new CibtData();
                cibt.Name = reader.ReadFixedLengthString(16).Trim();
                cibt.Unk1 = reader.ReadByte();
                cibt.Unk2 = reader.ReadByte();
                cibt.Unk3 = reader.ReadByte();
                cibt.Unk4 = reader.ReadByte();
                this.CibtData.Add(cibt);
            }
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:17,代码来源:CibtSection.cs


示例18: 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


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


示例20: Load

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

            Float1 = reader.ReadSingle();
            AnimationLength = reader.ReadSingle();
            Bones = reader.ReadInt16();
            NumIndices = reader.ReadInt16();
            Flags = reader.ReadByte();
            reader.BaseStream.Seek(3, System.IO.SeekOrigin.Current);
            for (var i = 0; i < NumIndices; i++)
            {
                int val = reader.ReadInt32();
                ChunkIndex idx = new ChunkIndex();
                idx.Index = val & 0x7FFFFFFF;
                idx.Flag = (val & 0x80000000) == 0x80000000;
                this.Offsets.Add(idx);
            }
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:19,代码来源:MtbSection.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# BinarySearchTree类代码示例发布时间:2022-05-24
下一篇:
C# BinaryReader类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap