public decimal GetDecimal() { int[] bits = new int[4]; bits[0] = (int)Biser.DecodeZigZag(this.rootDecoder.GetDigit()); bits[1] = (int)Biser.DecodeZigZag(this.rootDecoder.GetDigit()); bits[2] = (int)Biser.DecodeZigZag(this.rootDecoder.GetDigit()); bits[3] = (int)Biser.DecodeZigZag(this.rootDecoder.GetDigit()); return(new decimal(bits)); }
public ushort GetUShort() { if (!this.GetDigit(out var dgt)) { return(default(ushort)); } return((ushort)Biser.DecodeZigZag(dgt)); }
/// <summary> /// Javascript Biser decoder /// </summary> /// <returns></returns> public long JSGetLong() { if (!this.GetDigit(out var dgt)) { return(default(long)); } return(Biser.DecodeZigZag(dgt)); }
public int GetInt() { if (!this.GetDigit(out var dgt)) { return(default(int)); } return((int)Biser.DecodeZigZag(dgt)); }
} //eof public DateTime GetDateTime() { if (!this.GetDigit(out var dgt)) { return(default(DateTime)); } return(new DateTime(Biser.DecodeZigZag(dgt))); }
public decimal GetDecimal() { if (!this.GetDigit(out var dgt)) { return(default(decimal)); } int[] bits = new int[4]; bits[0] = (int)Biser.DecodeZigZag(dgt); this.GetDigit(out dgt); bits[1] = (int)Biser.DecodeZigZag(dgt); this.GetDigit(out dgt); bits[2] = (int)Biser.DecodeZigZag(dgt); this.GetDigit(out dgt); bits[3] = (int)Biser.DecodeZigZag(dgt); return(new decimal(bits)); }
/// <summary> /// null elements equal to new byte[0] /// </summary> /// <param name="d"></param> /// <returns></returns> public static byte[] Encode_PROTO_ListByteArray(IList <byte[]> d) { //null element of the list is not allowed (the same as in protobuf), byte[0] means String.Empty if (d == null || d.Count == 0) { return(new byte[0]); } byte[] tar1 = null; using (MemoryStream ms = new MemoryStream()) { foreach (var el in d) { //Setting key ms.Write(new byte[] { 10 }, 0, 1); //complex Type - 10 if (el == null || el.Length == 0) { ms.Write(new byte[] { 0 }, 0, 1);// 0 length element } else { tar1 = Biser.GetVarintBytes((ulong)el.Length); ms.Write(tar1, 0, tar1.Length); //length of key ms.Write(el, 0, el.Length); //key self } } tar1 = ms.ToArray(); #if !NETPORTABLE ms.Close(); #endif } return(tar1); }
public Encoder Add(short value) { GetVarintBytes((ulong)Biser.EncodeZigZag(value, 16)); return(this); }
public Encoder Add(long value) { GetVarintBytes((ulong)Biser.EncodeZigZag(value, 64)); return(this); }
/// <summary> /// Javascript Biser decoder /// </summary> /// <returns></returns> public long JSGetLong() { return(Biser.DecodeZigZag(this.rootDecoder.GetDigit())); }
public ushort GetUShort() { return((ushort)Biser.DecodeZigZag(this.rootDecoder.GetDigit())); }
public int GetInt() { return((int)Biser.DecodeZigZag(this.rootDecoder.GetDigit())); }
} //eof public DateTime GetDateTime() { return(new DateTime(Biser.DecodeZigZag(this.rootDecoder.GetDigit()))); }
public short GetShort() { return((short)Biser.DecodeZigZag(this.GetDigit())); }
public long GetLong() { return(Biser.DecodeZigZag(this.GetDigit())); }