Example #1
0
        public static TTTPacket Decode(string xmlStr)
        {
            TTTPacket     inPacket   = null;
            XmlSerializer serializer = new XmlSerializer(typeof(TTTPacket));

            using (StringReader textReader = new StringReader(xmlStr))
            {
                inPacket = (TTTPacket)serializer.Deserialize(textReader);
            }
            return(inPacket);
        }
Example #2
0
        public static string Encode(TTTPacket packet)
        {
            string        result     = null;
            XmlSerializer serializer = new XmlSerializer(typeof(TTTPacket));

            using (StringWriter textWriter = new StringWriter())
            {
                serializer.Serialize(textWriter, packet);
                result = textWriter.ToString();
            }
            return(result.Replace("\r\n", ""));
        }