public static StateLogEntrySuggestion BiserJsonDecode(string enc = null, Biser.JsonDecoder extDecoder = null, Biser.JsonSettings settings = null) //!!!!!!!!!!!!!! change return type { Biser.JsonDecoder decoder = null; if (extDecoder == null) { if (enc == null || String.IsNullOrEmpty(enc)) { return(null); } decoder = new Biser.JsonDecoder(enc, settings); if (decoder.CheckNull()) { return(null); } } else { //JSONSettings of the existing decoder will be used decoder = extDecoder; } StateLogEntrySuggestion m = new StateLogEntrySuggestion(); //!!!!!!!!!!!!!! change return type foreach (var props in decoder.GetDictionary <string>()) { switch (props) { case "LeaderTerm": m.LeaderTerm = decoder.GetULong(); break; case "StateLogEntry": m.StateLogEntry = StateLogEntry.BiserJsonDecode(null, decoder); break; case "IsCommitted": m.IsCommitted = decoder.GetBool(); break; default: decoder.SkipValue(); //Must be here break; } } return(m); }//eof
public static StateLogEntrySuggestion 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; } StateLogEntrySuggestion m = new StateLogEntrySuggestion(); //!!!!!!!!!!!!!! change return type m.LeaderTerm = decoder.GetULong(); m.StateLogEntry = StateLogEntry.BiserDecode(extDecoder: decoder); m.IsCommitted = decoder.GetBool(); return(m); }