コード例 #1
0
        //TODO: TimeZone
        public object Read(ProtoReader reader)
        {
            long ticks = 0;

            int offset = 0;
            byte[] buffer = reader.ReadByteArray();

            ticks |= (long)buffer[offset++];
            ticks |= (long)buffer[offset++] << 8;
            ticks |= (long)buffer[offset++] << 16;
            ticks |= (long)buffer[offset++] << 24;
            ticks |= (long)buffer[offset++] << 32;
            ticks |= (long)buffer[offset++] << 40;
            ticks |= (long)buffer[offset++] << 48;
            ticks |= (long)buffer[offset++] << 56;

            DateTimeKind kind = (DateTimeKind)buffer[offset++];

            if (kind == DateTimeKind.Local)
            {
                return new DateTime(ticks, DateTimeKind.Utc).ToLocalTime();
            }

            return new DateTime(ticks, kind);
        }
コード例 #2
0
        public object Read(ProtoReader reader)
        {
            int[] bits = new int[4];
            byte[] buffer = reader.ReadByteArray();

            Buffer.BlockCopy(buffer, 0, bits, 0, buffer.Length);

            return new Decimal(bits);
        }
コード例 #3
0
 public object Read(ProtoReader reader)
 {
     return reader.ReadByteArray();
 }
コード例 #4
0
 public object Read(ProtoReader reader)
 {
     return new Guid(reader.ReadByteArray());
 }