本文整理汇总了C#中IO.Write方法的典型用法代码示例。如果您正苦于以下问题:C# IO.Write方法的具体用法?C# IO.Write怎么用?C# IO.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IO
的用法示例。
在下文中一共展示了IO.Write方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Write
public override void Write(IO.EndianWriter stream)
{
Compiler comp = stream.Owner as Compiler;
uint elementsAddress = 0;
int flags = (
(tagRef.IsNonResolving ? 1<<1 : 0)
);
if (tagRef.Elements.Count > 1)
{
elementsAddress = stream.PositionUnsigned;
foreach (string i in tagRef.Elements)
stream.WriteTag(i);
comp.MarkLocationFixup(tagRef.Name, stream, true);
stream.Write(flags);
stream.Write((int)-1);
stream.WritePointer(elementsAddress);
}
else
{
comp.MarkLocationFixup(tagRef.Name, stream, true);
stream.Write(flags);
stream.WriteTag(tagRef.Elements[0]);
stream.Write((int)0);
}
}
示例2: Write
public override void Write(IO.EndianWriter stream)
{
Compiler comp = stream.Owner as Compiler;
comp.MarkLocationFixup(glob.Name, stream, false);
stream.Write(glob.Name);
stream.Write(glob.type.Opcode);
stream.Write((short)(glob.IsInternal ? 1 : 0));//stream.Write(ushort.MinValue);
stream.Write(uint.MaxValue);
stream.Write(uint.MinValue);
}
示例3: Write
public override void Write(IO.EndianWriter stream)
{
Compiler comp = stream.Owner as Compiler;
#region TypeIndex
if (field.TypeIndex == comp.TypeIndexStringId)
stream.Write(comp.TypeIndexTagReference);
else if (field.TypeIndex == comp.TypeIndexOldStringId)
stream.Write(comp.TypeIndexString);
else
stream.Write(field.TypeIndex);
#endregion
if (field.TypeIndex != comp.TypeIndexPad)
stream.Write(field.Name);
else
stream.Write((int)0);
if (field.TypeIndex == comp.TypeIndexArrayStart ||
field.TypeIndex == comp.TypeIndexPad ||
field.TypeIndex == comp.TypeIndexSkip)
stream.Write(field.ToInt());
else if (field.TypeIndex == comp.TypeIndexCustom)
stream.WriteTag(field.ToString());
else if (field.TypeIndex == comp.TypeIndexExplanation)
{
if (field.Definition != string.Empty)
stream.Write(field.ToPointer());
else
stream.Write(comp.Strings.GetNull());
}
else if (field.TypeIndex == comp.TypeIndexByteFlags ||
field.TypeIndex == comp.TypeIndexEnum ||
field.TypeIndex == comp.TypeIndexWordFlags ||
field.TypeIndex == comp.TypeIndexShortBlockIndex ||
field.TypeIndex == comp.TypeIndexLongFlags ||
field.TypeIndex == comp.TypeIndexLongBlockIndex ||
field.TypeIndex == comp.TypeIndexTagReference ||
field.TypeIndex == comp.TypeIndexData ||
field.TypeIndex == comp.TypeIndexBlock ||
field.TypeIndex == comp.TypeIndexStringId)
{
comp.AddLocationFixup(field.Definition, stream);
stream.Write((int)0); // should come back later and write the address
}
else if (field.TypeIndex == comp.TypeIndexOldStringId)
stream.WriteTag(Import.kStringIdGroupTag);
else if(field.TypeIndex == comp.TypeIndexString && !string.IsNullOrEmpty(field.Definition))
stream.Write(field.ToInt()); // string's length
else
stream.Write((int)0);
}
示例4: Write
public override void Write(IO.EndianWriter s)
{
s.Write((ushort)engine);
s.Write(ushort.MinValue);
#region FileNames
s.Write(files.Count);
foreach (string str in files) s.Write(str, true);
#endregion
}
示例5: Write
/// <summary>
/// Stream the field to a buffer
/// </summary>
/// <param name="ew"></param>
public override void Write(IO.EndianWriter ew)
{
if (this.fieldType == FieldType.ByteBlockIndex) ew.Write((sbyte)Value);
else if (this.fieldType == FieldType.ShortBlockIndex) ew.Write((short)Value);
else if (this.fieldType == FieldType.LongBlockIndex) ew.Write(Value);
}
示例6: Write
public void Write(IO.EndianWriter stream)
{
Compiler comp = stream.Owner as Compiler;
Import import = comp.OwnerState.Importer as Import;
int real_count = import.Groups.Count;
stream.Write("dynamic tag groups", false);
stream.Write((short)DataArray.MaxValue);
stream.Write((short)Item.Size);
stream.Write(true);
stream.Write(true);
stream.Write((short)0);
MiscGroups.data.Write(stream);
stream.Write((short)real_count);//stream.Write((short)Datums.Count);
stream.Write((short)real_count);//stream.Write((short)Datums.Count);
stream.Write(real_count);
stream.WritePointer(stream.PositionUnsigned + 4);
#region Write tag group datums
foreach (Import.TagGroup tg in import.Groups.Values)
{
stream.Write((short)0); // Header
stream.Write((short)0); // Flags
comp.AddLocationFixup(tg.Name, stream, false);
stream.Write((int)0);
}
#endregion
#region Write null datums
Item i = new Item();
int count = DataArray.MaxValue - real_count;
for (int x = 0; x < count; x++)
i.Write(stream);
#endregion
}
示例7: Write
/// <summary>
/// Stream the field to a buffer
/// </summary>
/// <param name="output"></param>
public override void Write(IO.EndianWriter output)
{
if (StringType == StringType.Normal) output.Write(Value, false);
else if (StringType == StringType.Unicode) output.WriteUnicodeString(Value, Length);
else if (StringType == StringType.Ascii) output.Write(Value, Length);
else if (StringType == StringType.Halo1Profile) output.WriteUnicodeString(Value, 12);
else if (StringType == StringType.Halo2Profile) output.WriteUnicodeString(Value, 16);
else if (StringType == StringType.CString) output.Write(Value, true);
}
示例8: Write
/// <summary>
/// Extension method for <see cref="BlamVersion"/> for streaming an instance to a stream
/// </summary>
/// <param name="version"></param>
/// <param name="s"></param>
public static void Write(this BlamVersion version, IO.EndianWriter s) { s.Write((ushort)version); }
示例9: WriteFields
public uint WriteFields(IO.EndianWriter stream, Compiler comp)
{
uint fieldsAddress = stream.PositionUnsigned;
WriteFieldsRecursive(stream, comp, mFields);
stream.Write(comp.TypeIndexTerminator); stream.Write((int)0); stream.Write((int)0);
return fieldsAddress;
}
示例10: Write
/// <summary>
/// Stream the field to a buffer
/// </summary>
/// <param name="output"></param>
public override void Write(IO.EndianWriter output)
{
byte[] temp = new byte[Value];
temp.Initialize();
output.Write(temp);
temp = null;
}
示例11: Write
public void Write(IO.EndianWriter stream)
{
Blam.MiscGroups.head.Write(stream);
stream.Write(kVersion);
engineSignature.Write(stream);
stream.Write(uint.MinValue);
stream.Write(baseAddress);
stream.Write(dataOffset);
stream.Write(stringPoolSize);
stream.Write(stringPoolAddress);
stream.Write(scriptFunctionsCount);
stream.Write(scriptFunctionsAddress);
stream.Write(scriptGlobalsCount);
stream.Write(scriptGlobalsAddress);
stream.Write(fixupCount);
stream.Write(fixupAddress);
stream.Write(uint.MinValue);
stream.Write(uint.MinValue);
stream.Write(Padding);
Blam.MiscGroups.tail.Write(stream);
}
示例12: Write
/// <summary>
/// Stream the resource pointer to a buffer
/// </summary>
/// <param name="output"></param>
public void Write(IO.EndianWriter output) { output.Write(Ptr); }
示例13: RamToStream
internal void RamToStream(IO.EndianWriter stream, uint reference, int length)
{
var ms = RamMemory.BaseStream as System.IO.MemoryStream;
byte[] buffer = new byte[length];
ms.Seek(reference, System.IO.SeekOrigin.Begin);
ms.Read(buffer, 0, length);
stream.Write(buffer);
int align = 4 - (stream.Length % 4);
if (align != 4) stream.Write(new byte[align]);
}