本文整理汇总了C#中System.IO.BinaryWriter.WriteLpString方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryWriter.WriteLpString方法的具体用法?C# BinaryWriter.WriteLpString怎么用?C# BinaryWriter.WriteLpString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.BinaryWriter
的用法示例。
在下文中一共展示了BinaryWriter.WriteLpString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Write
public void Write(BinaryWriter writer, IEnumerable<string> materials)
{
writer.Write(materials.Count());
foreach (string material in materials)
{
writer.WriteLpString(material);
}
}
示例2: Write
public void Write(BinaryWriter writer)
{
writer.WriteBooleanAsInt32(IsPartOfALayer);
if (IsPartOfALayer)
{
writer.Write(LayerDeclaration);
writer.Write(LayerMasks.Count());
foreach (uint mask in LayerMasks)
{
writer.Write(mask);
}
}
writer.Write(GroupId);
writer.WriteLpString(EntityName);
foreach (var pair in Fields)
{
writer.Write(NewAttributeDeclaration);
TypeSerializer.Write(writer, pair.Key, pair.Value);
}
}
示例3: Write
public void Write(BinaryWriter writer, string name, IType type)
{
long sizePosition = writer.BaseStream.Position;
writer.Seek(4, SeekOrigin.Current);
long startPos = writer.BaseStream.Position;
writer.WriteLpString(name);
writer.Write(type.TypeId);
writer.Write(type.NumFields);
writer.Write(0);
type.Write(writer);
long endPos = writer.BaseStream.Position;
int length = (int)(endPos - startPos);
writer.Seek((int)sizePosition, SeekOrigin.Begin);
writer.Write(length);
writer.Seek((int)endPos, SeekOrigin.Begin);
}
示例4: BinaryWriter_WriteLpString
public void BinaryWriter_WriteLpString()
{
byte[] writtenData;
using (var stream = new MemoryStream())
{
using (var writer = new BinaryWriter(stream))
{
writer.WriteLpString("hello world");
}
writtenData = stream.ToArray();
}
byte[] expected = { 0x0B, 0x00, 0x00, 0x00, 0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64 };
Assert.AreEqual(BitConverter.ToString(expected), BitConverter.ToString(writtenData));
Assert.AreEqual(expected.Length, writtenData.Length);
}