本文整理汇总了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;
}
示例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);
}
示例3: InternalWrite
/*****************/
/**** Methods ****/
/*****************/
internal void InternalWrite(BinaryWriter writer)
{
writer.WriteCString(_name, MAX_NAME_LENGTH);
writer.Write(DataLength);
writer.Write(Data);
writer.AlignPosition(64);
}
示例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);
}
示例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;
}
示例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);
}
}
示例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);
}
示例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);
}
示例9: WriteMapGroup
private static void WriteMapGroup(BinaryWriter bw, Group g)
{
bw.WriteCString("CMapGroup");
WriteMapBase(bw, g);
}
示例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
}
示例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
}
示例12: WriteProperty
public static void WriteProperty(BinaryWriter bw, Property p)
{
bw.WriteCString(p.Key);
bw.WriteCString(p.Value);
}
示例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);
}
示例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);
}
示例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);
}
}