Example #1
0
        public decimal ReadDecimal()
        {
            UIntDecimal converter = new UIntDecimal {
                longValue1 = ReadUInt64(), longValue2 = ReadUInt64()
            };

            return(converter.decimalValue);
        }
Example #2
0
        public static decimal ReadDecimal(this NetworkReader reader)
        {
            UIntDecimal converter = new UIntDecimal();

            converter.longValue1 = reader.ReadUInt64();
            converter.longValue2 = reader.ReadUInt64();
            return(converter.decimalValue);
        }
Example #3
0
        public void Write(decimal value)
        {
            // the only way to read it without allocations is to both read and
            // write it with the FloatConverter (which is not binary compatible
            // to writer.Write(decimal), hence why we use it here too)
            UIntDecimal converter = new UIntDecimal();

            converter.decimalValue = value;
            Write(converter.longValue1);
            Write(converter.longValue2);
        }
Example #4
0
        public static void WriteDecimal(this NetworkWriter writer, decimal value)
        {
            // the only way to read it without allocations is to both read and
            // write it with the FloatConverter (which is not binary compatible
            // to writer.Write(decimal), hence why we use it here too)
            UIntDecimal converter = new UIntDecimal
            {
                decimalValue = value
            };

            writer.WriteUInt64(converter.longValue1);
            writer.WriteUInt64(converter.longValue2);
        }