static void TestT5() { //Testing extensions with IDecoder and Biser.Extension interface TS5 voc = new TS5() { TermId = 12, VoteType = TS5.eVoteType.VoteReject }; var lst = new List <TS5> { voc, voc, voc }; var btEn = lst.BiserEncodeList(); var lst1 = btEn.BiserDecodeList <TS5>(); }
public static TS5 BiserDecode(byte[] enc = null, Biser.Decoder extDecoder = null) //!!!!!!!!!!!!!! change return type { Biser.Decoder decoder = null; if (extDecoder == null) { if (enc == null || enc.Length == 0) { return(null); } decoder = new Biser.Decoder(enc); if (decoder.CheckNull()) { return(null); } } else { if (extDecoder.CheckNull()) { return(null); } else { decoder = extDecoder; } //decoder = new Biser.Decoder(extDecoder); //if (decoder.IsNull) // return null; } TS5 m = new TS5(); //!!!!!!!!!!!!!! change return type m.TermId = decoder.GetUInt(); m.VoteType = (eVoteType)decoder.GetInt(); return(m); }
/// <summary> /// To create extensions (check IDecoder interface implementaiton, Program.cs and BiserExtension.cs) /// </summary> /// <param name="extDecoder"></param> /// <returns></returns> public object BiserDecodeToObject(Biser.Decoder extDecoder) { return(TS5.BiserDecode(null, extDecoder)); }
/// <summary> /// To create extensions (check IDecoder interface implementaiton, Program.cs and BiserExtension.cs) /// </summary> /// <param name="enc"></param> /// <returns></returns> public object BiserDecodeToObject(byte[] encoded) { return(TS5.BiserDecode(encoded)); }