本文整理匯總了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);
}