/*//Deserialize from airInterface to obj * public static object DeserializeAirInterface(byte[] encodedData, Type objectType) * { * int digits = 4; * byte[] rest = new byte[encodedData.Length - digits]; * Array.Copy(encodedData, digits, rest, 0, (encodedData.Length - digits)); * * MemoryStream ms = new MemoryStream(rest); * Object obj; * obj = FastInfoSetSerializer.DeSerialize(ms, objectType); * Print.PrintMessageToConsole(obj); * * return obj; * }*/ //Deserialize fastinfoset logged in DB public static object DeserializeFIInDB(byte[] encodedData, Type objectType) { MemoryStream ms = new MemoryStream(encodedData); Object obj; obj = FastInfoSetSerializer.DeSerialize(ms, objectType); Print.PrintMessageToConsole(obj); return(obj); }
static public MemoryStream Deserialize(MemoryStream ms, MessageContentType msgContentType) { if (msgContentType == MessageContentType.Xml) { return(ms); // Either already in XML or an explicit serialization will be called by Comm. Manager } else if (msgContentType == MessageContentType.FastInfoSet) { return(FastInfoSetSerializer.DeSerialize(ms)); } throw new ArgumentOutOfRangeException("msgContentType"); }
static public MemoryStream Serialize(MemoryStream ms, MessageContentType msgContentType) { if (ms == null) { throw new ArgumentNullException("ms"); } if (msgContentType == MessageContentType.Xml) { return(ms); // Already in XML } else if (msgContentType == MessageContentType.FastInfoSet) { return(FastInfoSetSerializer.Serialize(ms)); } throw new ArgumentOutOfRangeException("msgContentType"); }