Beispiel #1
0
        /*//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);
        }
Beispiel #2
0
        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");
        }