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


C# BinaryReaderEx.ReadNullTerminatedString方法代码示例

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


在下文中一共展示了BinaryReaderEx.ReadNullTerminatedString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

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

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

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

示例6: LoadStringTable

        private void LoadStringTable(BinaryReaderEx reader)
        {
            // Load String Table
            this.StringTable = new List<string>(this.SkeletonHeader.NumStrings);
            reader.BaseStream.Position = this.BasePosition + this.SkeletonHeader.StringTableOffset;

            for (var i = 0; i < this.SkeletonHeader.NumStrings; i++)
            {
                this.StringTable.Add(reader.ReadNullTerminatedString());
            }
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:11,代码来源:SkeletonSection.cs

示例7: LoadSection

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

            long baseOffset = reader.BaseStream.Position;
            List<short> offsets = new List<short>();
            short strOffset = reader.ReadInt16();
            int numOffsets = strOffset / 2;
            offsets.Add(strOffset);
            for (var o = 1; o < numOffsets; o++)
            {
                strOffset = reader.ReadInt16();
                if (strOffset == 0) { continue; }
                offsets.Add(strOffset);
            }

            this.Strings = new List<string>(offsets.Count);
            for (var i = 0; i < offsets.Count; i++)
            {
                reader.BaseStream.Position = baseOffset + offsets[i];
                this.Strings.Add(reader.ReadNullTerminatedString());
            }
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:23,代码来源:McbSection.cs

示例8: LoadResourceIds

        private void LoadResourceIds(BinaryReaderEx reader)
        {
            this.ResourceIds = new List<string>(this.ResourceHeader.NumResources);

            var idTableOffset = this.BasePosition + this.Resources[this.ResourceHeader.NumResources - 1].Offset;
            for (var i = 0; i < this.ResourceHeader.NumResources; i++)
            {
                reader.BaseStream.Position = idTableOffset;
                this.ResourceIds.Add(reader.ReadNullTerminatedString());
                idTableOffset += 0x10;
            }
        }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:12,代码来源:ResourceSection.cs

示例9: LoadStrings

 private void LoadStrings(BinaryReaderEx reader, int[] offsets, List<string> list)
 {
     long pos = reader.BaseStream.Position;
     for (var i = 0; i < offsets.Length; i++)
     {
         reader.BaseStream.Position = this.SectionStart + offsets[i];
         list.Add(reader.ReadNullTerminatedString());
     }
     reader.BaseStream.Position = pos;
 }
开发者ID:nohbdy,项目名称:ffxivmodelviewer,代码行数:10,代码来源:MtbSection.cs


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