本文整理汇总了C#中System.IO.BinaryWriter.WriteFixedString方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryWriter.WriteFixedString方法的具体用法?C# BinaryWriter.WriteFixedString怎么用?C# BinaryWriter.WriteFixedString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.BinaryWriter
的用法示例。
在下文中一共展示了BinaryWriter.WriteFixedString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1:
void ISerializable.Serialize(BinaryWriter writer)
{
writer.Write(Magic);
writer.WriteFixedString(Command, 12);
writer.Write(Payload.Length);
writer.Write(Checksum);
writer.Write(Payload);
}
示例2: EncodeMessage
public static void EncodeMessage(BinaryWriter writer, Message message)
{
writer.WriteUInt32(message.Magic);
writer.WriteFixedString(12, message.Command);
writer.WriteUInt32(message.PayloadSize);
writer.WriteUInt32(message.PayloadChecksum);
writer.WriteBytes(message.PayloadSize.ToIntChecked(), message.Payload.ToArray());
}
示例3: Write
public void Write(BinaryWriter writer)
{
writer.WriteFixedString(Name.ToLower());
writer.WriteFixedString(ImagePath.ToLower());
writer.Write(Margin);
writer.Write(Spacing);
writer.Write(TileCount);
writer.Write(TileWidth);
writer.Write(TileHeight);
writer.Write(FirstGid);
writer.Write(PropertyEntries.Count);
foreach (var entry in PropertyEntries)
entry.Write(writer);
}
示例4: EncodeMessage
public static void EncodeMessage(Stream stream, Message message)
{
using (var writer = new BinaryWriter(stream, Encoding.ASCII, leaveOpen: true))
{
writer.Write4Bytes(message.Magic);
writer.WriteFixedString(12, message.Command);
writer.Write4Bytes(message.PayloadSize);
writer.Write4Bytes(message.PayloadChecksum);
writer.WriteBytes(message.PayloadSize.ToIntChecked(), message.Payload.ToArray());
}
}