public void Write(IO.EndianWriter stream) { foreach (string s in pool) { if (s == string.Empty) { stream.Write((byte)0); // stream won't write a empty string so we hard code it :/ } else { stream.Write(s, true); } } }
public override void Write(EndianWriter s) { s.Write(Directory); s.Write(Files.Count); foreach (string str in Files.Keys) { List <string> files = Files[str]; s.Write(str); s.Write(files.Count); foreach (string file in files) { s.Write(file); } } }
/// <summary> /// Write all of the string offsets to a stream /// </summary> /// <param name="stream"></param> public void WriteOffsets(IO.EndianWriter stream) { foreach (int i in offsets) { stream.Write(i); } }
/// <summary>Write a <typeparamref name="TEnum"/> value to a stream</summary> /// <param name="s">Stream to write to</param> /// <param name="value">Value to write to the stream</param> /// <remarks> /// Uses <typeparamref name="TEnum"/>'s underlying <see cref="TypeCode"/> to /// decide how big of a numeric type to write to the stream. /// </remarks> public static void Write(IO.EndianWriter s, TEnum value) { //Contract.Requires(s != null); uint stream_value = Reflection.EnumValue <TEnum> .ToUInt32(value); switch (kUnderlyingType) { case TypeCode.Byte: case TypeCode.SByte: s.Write((byte)stream_value); break; case TypeCode.Int16: case TypeCode.UInt16: s.Write((ushort)stream_value); break; case TypeCode.Int32: case TypeCode.UInt32: s.Write(stream_value); break; default: throw new Debug.Exceptions.UnreachableException(); } }
/// <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); }
/// <summary> /// Extension method for <see cref="BlamPlatform"/> for streaming an instance to a stream /// </summary> /// <param name="platform"></param> /// <param name="s"></param> public static void Write(this BlamPlatform platform, IO.EndianWriter s) { s.Write((ushort)platform); }
/// <summary> /// Extension method for <see cref="BlamBuild"/> for streaming an instance to a stream /// </summary> /// <param name="build"></param> /// <param name="s"></param> public static void Write(this BlamBuild build, IO.EndianWriter s) { s.Write((ushort)build); }