當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。