/// <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);
     }
 }
 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);
         }
     }
 }
        /// <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();
            }
        }
Exemplo n.º 4
0
		/// <summary>
		/// Stream the contents of the file to a buffer
		/// </summary>
		/// <param name="s"></param>
		public abstract void Write(EndianWriter s);
Exemplo n.º 5
0
 /// <summary>
 /// Stream the contents of the file to a buffer
 /// </summary>
 /// <param name="s"></param>
 public abstract void Write(EndianWriter s);
Exemplo n.º 6
0
 /// <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);
 }
Exemplo n.º 7
0
 /// <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);
 }
Exemplo n.º 8
0
 /// <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);
 }