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


C# BinaryWriter.WriteCString方法代码示例

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


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

示例1: Write

        public override bool Write(BinaryWriter bw)
        {
            base.Write(bw);

            bw.Write((int)version);
            bw.WriteCString(login, 24);
            bw.WriteCString(pw, 24);
            bw.Write((byte)type);
            bw.Flush();

            return true;
        }
开发者ID:GodLesZ,项目名称:FimbulwinterClient,代码行数:12,代码来源:CA_Login.cs

示例2: InternalWrite

 // Internal Methods
 internal void InternalWrite(BinaryWriter writer)
 {
     writer.Write(_unk0x00);
     writer.WriteCString(_comment, 16);
     writer.Write(_textureIndex);
     writer.Write(_unk0x18);
     writer.Write(_unk0x1C);
     writer.Write(_unk0x20);
     writer.Write(_unk0x24);
     writer.Write(_unk0x28);
     writer.Write(_unk0x2C);
     writer.Write(_unk0x30);
     writer.Write(_unk0x34);
     writer.Write(_unk0x38);
     writer.Write(_unk0x3C);
     writer.Write(_unk0x40);
     writer.Write(_unk0x44);
     writer.Write(_unk0x48);
     writer.Write(_unk0x4C);
     writer.Write(_unk0x50);
     writer.Write(_unk0x54);
     writer.Write(_unk0x58);
     writer.Write(_unk0x5C);
     writer.Write(_unk0x60);
     writer.Write(_unk0x64);
     writer.Write(_unk0x68);
     writer.Write(_unk0x6C);
     writer.Write(_unk0x70);
     writer.Write(_unk0x74);
     writer.Write(_unk0x78);
     writer.Write(_unk0x7C);
 }
开发者ID:TGEnigma,项目名称:Amicitia,代码行数:33,代码来源:SPRKeyFrame.cs

示例3: InternalWrite

        /*****************/
        /**** Methods ****/
        /*****************/

        internal void InternalWrite(BinaryWriter writer)
        {
            writer.WriteCString(_name, MAX_NAME_LENGTH);
            writer.Write(DataLength);
            writer.Write(Data);
            writer.AlignPosition(64);
        }
开发者ID:TGEnigma,项目名称:Amicitia,代码行数:11,代码来源:PAKToolArchiveEntry.cs

示例4: Write

        // Internal Methods
        internal void Write(BinaryWriter writer)
        {
            // Save start offset and seek past the header
            long startOffset = writer.BaseStream.Position;
            writer.BaseStream.Seek(0x08, SeekOrigin.Current);

            // Write entries
            for (int i = 0; i < _names.Length; i++)
            {
                writer.WriteCStringAligned(_names[i].Name);
                writer.Write(_names[i].ID);
            }

            // Save end offset and calculate the size of the section
            long endOffset = writer.BaseStream.Position;
            _length = (uint)(endOffset - startOffset);

            // Seek back to the start and write the header
            writer.BaseStream.Seek(startOffset, SeekOrigin.Begin);
            writer.WriteCString(TAG, 4);
            writer.Write(_length);

            // Seek to the end of the section to align the writer position
            writer.BaseStream.Seek(endOffset, SeekOrigin.Begin);
        }
开发者ID:TGEnigma,项目名称:Amicitia,代码行数:26,代码来源:NDNM.cs

示例5: GetUpdateAccountDataPkt

 private static IPacket GetUpdateAccountDataPkt(AccpuntData accpuntData)
 {
     IPacket packet = WorldPacketFactory.Create(WMSG.SMSG_UPDATE_ACCOUNT_DATA);
     BinaryWriter writer = packet.CreateWriter();
     writer.Write(accpuntData.Guid);
     writer.Write((uint)accpuntData.Type);
     writer.Write(accpuntData.Time.ToUnixTimestamp());
     writer = new BinaryWriter(new DeflaterOutputStream(writer.BaseStream));
     writer.WriteCString(accpuntData.Data);
     writer.Flush();
     return packet;
 }
开发者ID:hazzik,项目名称:uwow2,代码行数:12,代码来源:RequestAccountDataDispatcher.cs

示例6: WriteStringSection

        protected void WriteStringSection(BinaryWriter writer, string[] array, int stringLength)
        {
            using (BinaryWriter sectionWriter = new BinaryWriter(new MemoryStream()))
            {
                // write the strings to the memory stream
                foreach (string item in array)
                {
                    sectionWriter.WriteCString(item, stringLength);
                }

                // write the section to the file using the memory stream we just wrote to
                WriteSection(writer, sectionWriter.BaseStream);
            }
        }
开发者ID:TGEnigma,项目名称:Amicitia,代码行数:14,代码来源:MessageTableBase.cs

示例7: InternalWrite

        internal override void InternalWrite(BinaryWriter writer, ref List<int> addressList, int fp)
        {
            // Write header fields
            writer.WriteCString(name, NAME_LENGTH);
            writer.Write(_field18);
            writer.Write((ushort)DialogCount);
            
            // unknown zero
            writer.Write(0);

            // Save the pointer table offset for writing later
            long pagePointerTableOffset = writer.BaseStream.Position;

            // dummy page pointer table
            for (int i = 0; i < DialogCount; i++)
            {
                addressList.Add((int)writer.BaseStream.Position - fp);
                writer.Write(0);
            }

            // dummy length
            writer.Write(0);

            int[] pagePointerTable = new int[DialogCount];

            // Write the pages
            long pageDataStart = writer.BaseStream.Position;
            for (int i = 0; i < DialogCount; i++)
            {
                pagePointerTable[i] = (int)writer.BaseStream.Position - BMDFile.DATA_START_ADDRESS - fp;
                dialogs[i].InternalWrite(writer);
            }

            long dialogDataEnd = writer.BaseStream.Position;

            // Calculate the page data length
            int pageDataLength = (int)(dialogDataEnd - pageDataStart);

            // Seek to the pointer table and write it
            writer.BaseStream.Seek(pagePointerTableOffset, SeekOrigin.Begin);
            writer.Write(pagePointerTable);
            writer.Write(pageDataLength);

            // Seek back to the end of the data
            writer.BaseStream.Seek(dialogDataEnd, SeekOrigin.Begin);
        }
开发者ID:TGEnigma,项目名称:Amicitia,代码行数:46,代码来源:BMDSelectionMessage.cs

示例8: InternalWrite

        // Internal Methods
        internal override void InternalWrite(BinaryWriter writer)
        {
            int posFileStart = (int)writer.BaseStream.Position;

            // Seek past chunk header
            writer.BaseStream.Seek(HEADER_SIZE + 4, SeekOrigin.Current);

            // Seek past texture pack header
            writer.BaseStream.Seek(TextureCount * sizeof(int), SeekOrigin.Current);

            int[] texturePointerTable = new int[TextureCount];

            // Write texture data
            for (int i = 0; i < TextureCount; i++)
            {
                writer.AlignPosition(64);
                texturePointerTable[i] = (int)(writer.BaseStream.Position - posFileStart);
                _textures[i].InternalWrite(writer);
            }

            // Calculate length
            long posFileEnd = writer.BaseStream.Position;
            int length = (int)(posFileEnd - posFileStart);

            // Write header
            writer.BaseStream.Seek(posFileStart, SeekOrigin.Begin);
            writer.Write(FLAG);
            writer.Write((short)0); // userID
            writer.Write(length);
            writer.WriteCString(TAG, 4);
            writer.Write(0);
            writer.Write(TextureCount);

            // Write pointer table
            writer.Write(texturePointerTable);
            
            // Seek to end
            writer.BaseStream.Seek(posFileEnd, SeekOrigin.Begin);
        }
开发者ID:TGEnigma,项目名称:Amicitia,代码行数:40,代码来源:TBFile.cs

示例9: WriteMapGroup

 private static void WriteMapGroup(BinaryWriter bw, Group g)
 {
     bw.WriteCString("CMapGroup");
     WriteMapBase(bw, g);
 }
开发者ID:074769,项目名称:sledge,代码行数:5,代码来源:RmfProvider.cs

示例10: WriteMapEntity

 private static void WriteMapEntity(BinaryWriter bw, Entity ent)
 {
     bw.WriteCString("CMapEntity");
     WriteMapBase(bw, ent);
     WriteEntityData(bw, ent.EntityData);
     bw.Write(new byte[2]); // Unused
     bw.WriteCoordinate(ent.Origin);
     bw.Write(new byte[4]); // Unused
 }
开发者ID:074769,项目名称:sledge,代码行数:9,代码来源:RmfProvider.cs

示例11: WriteEntityData

 private static void WriteEntityData(BinaryWriter bw, EntityData data)
 {
     bw.WriteCString(data.Name);
     bw.Write(new byte[4]); // Unused
     bw.Write(data.Flags);
     bw.Write(data.Properties.Count);
     foreach (var property in data.Properties)
     {
         WriteProperty(bw, property);
     }
     bw.Write(new byte[12]); // Unused
 }
开发者ID:074769,项目名称:sledge,代码行数:12,代码来源:RmfProvider.cs

示例12: WriteProperty

 public static void WriteProperty(BinaryWriter bw, Property p)
 {
     bw.WriteCString(p.Key);
     bw.WriteCString(p.Value);
 }
开发者ID:074769,项目名称:sledge,代码行数:5,代码来源:RmfProvider.cs

示例13: InternalWrite

 internal override void InternalWrite(BinaryWriter writer)
 {
     writer.WriteCString(m_tag, TAG_LENGTH);
     writer.Write(m_flags);
     writer.Write(Size);
     writer.Write(m_data);
 }
开发者ID:TGEnigma,项目名称:Amicitia,代码行数:7,代码来源:AMDChunk.cs

示例14: Write

        /// <summary>
        /// スクリプトを書き出します。
        /// </summary>
        public void Write(BinaryWriter bw)
        {
            bw.WriteCString(this.name);
            bw.Write(this.lines.Length);

            foreach (string line in this.lines)
                bw.WriteCString(line);
        }
开发者ID:3dcustom,项目名称:tsoview-dx,代码行数:11,代码来源:TSOFile.cs

示例15: InternalWrite

        // write the data using the binary writer
        internal override void InternalWrite(BinaryWriter writer)
        {
            // write magic
            writer.WriteCString(MAGIC, MAGIC_LENGTH);

            // write chunk list
            writer.Write(ChunkCount);
            foreach (AMDChunk chunk in Chunks)
            {
                chunk.InternalWrite(writer);
            }
        }
开发者ID:TGEnigma,项目名称:Amicitia,代码行数:13,代码来源:AMDFile.cs


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