本文整理汇总了C#中Struct.Write方法的典型用法代码示例。如果您正苦于以下问题:C# Struct.Write方法的具体用法?C# Struct.Write怎么用?C# Struct.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Struct
的用法示例。
在下文中一共展示了Struct.Write方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteStruct
public void WriteStruct(int type, Struct s)
{
if (s == null)
{
s = Struct.Create(type);
}
int width = s.GetSizeWidth();
int pos = -1;
if (width > 0)
{
pos = BeginSize(width);
}
if (type > 0)
{
WriteUint16(type);
}
s.Write(this);
if (width > 0)
{
EndSize(width, pos);
}
}
示例2: WriteStruct32
public void WriteStruct32(Struct s)
{
if (s == null)
{
WriteUint32(0);
}
else
{
int pos = BeginSize32();
WriteUint16(s.GetEncodedType());
s.Write(this);
EndSize32(pos);
}
}
示例3: Write
public override void Write(IO.EndianWriter stream)
{
const int k_alignment = Compiler.kDefaultAlignment;
int align;
using (var mem = InitializeMemoryStream())
{
DynamicTagGroups.Write(MemoryStream); // write the data array to the stream
MemoryStream.Write((int)0); MemoryStream.Write((int)0); // alignment
StringPoolToMemoryStream();
Import import = OwnerState.Importer as Import;
FixupsToMemoryStream();
#region Scripting
{
}
#endregion
EnumerationsToMemoryStream();
TagReferencesToMemoryStream();
TagDataToMemoryStream();
#region TagBlock
TagBlock tb = new TagBlock();
foreach (Import.TagBlock tagb in import.Blocks.Values)
{
tb.Reset(tagb);
tb.Write(MemoryStream);
}
#endregion
#region Struct
Struct strct = new Struct();
foreach (Import.Struct tags in import.Structs.Values)
{
strct.Reset(tags);
strct.Write(MemoryStream);
}
#endregion
#region TagGroup
TagGroup tg = new TagGroup();
foreach (Import.TagGroup tagg in import.Groups.Values)
{
tg.Reset(tagg);
tg.Write(MemoryStream);
}
#endregion
PostprocessWritebacks();
// Create header
PostprocessHeaderThenStream(stream, CalculateStringPoolBaseAddress());
mem.WriteTo(stream.BaseStream); // write all the data that will be read into memory from a tool to the file
}
align = k_alignment - (stream.Length % k_alignment);
if (align != k_alignment) stream.Write(new byte[align]);
}