public float ReadFloat() { var bytes = ReadBytes(4); EndianUtility.EndianCorrection(bytes); return(BitConverter.ToSingle(bytes, 0)); }
public Int64 ReadLong() { var bytes = ReadBytes(8); EndianUtility.EndianCorrection(bytes); return(BitConverter.ToInt64(bytes, 0)); }
public Int32 ReadInt() { var bytes = ReadBytes(4); EndianUtility.EndianCorrection(bytes); return(BitConverter.ToInt32(bytes, 0)); }
// Default types public Int16 ReadShort() { var bytes = ReadBytes(2); EndianUtility.EndianCorrection(bytes); return(BitConverter.ToInt16(bytes, 0)); }
public double ReadDouble() { var bytes = ReadBytes(8); EndianUtility.EndianCorrection(bytes); return(BitConverter.ToDouble(bytes, 0)); }
public BytesWriter WriteDouble(double value) { var bytes = BitConverter.GetBytes(value); EndianUtility.EndianCorrection(bytes); WriteBytes(bytes); return(this); }
public BytesWriter WriteVector2(Vector2 value) { var xbytes = BitConverter.GetBytes(value.x); var ybytes = BitConverter.GetBytes(value.y); EndianUtility.EndianCorrection(xbytes); EndianUtility.EndianCorrection(ybytes); WriteBytes(xbytes); WriteBytes(ybytes); return(this); }
public BytesWriter WriteRectArray(Rect[] array) { var lenB = BitConverter.GetBytes(array.Length); EndianUtility.EndianCorrection(lenB); WriteBytes(lenB); foreach (var e in array) { WriteRect(e); } return(this); }
public BytesWriter WriteRect(Rect rect) { var xbytes = BitConverter.GetBytes(rect.x); var ybytes = BitConverter.GetBytes(rect.y); var wbytes = BitConverter.GetBytes(rect.width); var hbytes = BitConverter.GetBytes(rect.height); EndianUtility.EndianCorrection(xbytes); EndianUtility.EndianCorrection(ybytes); EndianUtility.EndianCorrection(wbytes); EndianUtility.EndianCorrection(hbytes); WriteBytes(xbytes); WriteBytes(ybytes); WriteBytes(wbytes); WriteBytes(hbytes); return(this); }