using System;

namespace DM2AE
{
	// 
	public abstract class BinaryWriteThru
	{
		// 
		private System.IO.Stream m_pFileInto;
		// 
		public BinaryWriteThru(
			System.IO.Stream pFileInto
			)
		{
			m_pFileInto = pFileInto;
		}
		// 
		public void Write(System.Byte x)
		{
			m_pFileInto.WriteByte(x);
		}
		// 
		public void Write(System.Byte[] x)
		{
			m_pFileInto.Write(x, 0, x.Length);
		}
		// 
		public void Write(System.Byte[] x, int offset, int count)
		{
			m_pFileInto.Write(x, offset, count);
		}
		// 
		public abstract void Write(System.UInt16 x);
		// 
		public abstract void Write(System.UInt32 x);
	}
	// 
	public class BinaryWriteThruLE : BinaryWriteThru
	{
		// 
		public BinaryWriteThruLE(
			System.IO.Stream pFileInto
			) : base(pFileInto)
		{

		}
		// 
		public override void Write(System.UInt16 x)
		{
			Write(System.Convert.ToByte((x >> 0) & 0xFF));
			Write(System.Convert.ToByte((x >> 8) & 0xFF));
		}
		// 
		public override void Write(System.UInt32 x)
		{
			Write(System.Convert.ToByte((x >> 0) & 0xFF));
			Write(System.Convert.ToByte((x >> 8) & 0xFF));
			Write(System.Convert.ToByte((x >>16) & 0xFF));
			Write(System.Convert.ToByte((x >>24) & 0xFF));
		}
	}
}
