Beispiel #1
0
        public double ReadDouble()
        {
            var bytes = ReadBytes(8);

            EndianUtility.EndianCorrection(bytes);
            return(BitConverter.ToDouble(bytes, 0));
        }
Beispiel #2
0
        public float ReadFloat()
        {
            var bytes = ReadBytes(4);

            EndianUtility.EndianCorrection(bytes);
            return(BitConverter.ToSingle(bytes, 0));
        }
Beispiel #3
0
        public Int64 ReadLong()
        {
            var bytes = ReadBytes(8);

            EndianUtility.EndianCorrection(bytes);
            return(BitConverter.ToInt64(bytes, 0));
        }
Beispiel #4
0
        public Int32 ReadInt()
        {
            var bytes = ReadBytes(4);

            EndianUtility.EndianCorrection(bytes);
            return(BitConverter.ToInt32(bytes, 0));
        }
Beispiel #5
0
        // Default types
        public Int16 ReadShort()
        {
            var bytes = ReadBytes(2);

            EndianUtility.EndianCorrection(bytes);
            return(BitConverter.ToInt16(bytes, 0));
        }
Beispiel #6
0
        public UniStreamWriter WriteDouble(double value)
        {
            var bytes = BitConverter.GetBytes(value);

            EndianUtility.EndianCorrection(bytes);
            WriteBytes(bytes);
            return(this);
        }
Beispiel #7
0
        public UniStreamWriter 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);
        }
Beispiel #8
0
        public UniStreamWriter WriteRectArray(Rect[] array)
        {
            var lenB = BitConverter.GetBytes(array.Length);

            EndianUtility.EndianCorrection(lenB);
            WriteBytes(lenB);

            foreach (var e in array)
            {
                WriteRect(e);
            }

            return(this);
        }
Beispiel #9
0
        public UniStreamWriter 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);
        }