Exemple #1
0
        private void test()
        {
            string   header = "07040202030300150000";
            Guid     uid    = Guid.NewGuid();
            DateTime pd     = DateTime.Now;
            string   body   = "1.0.1.113092015winhyf你好出行者";
            int      pcc    = (Convert.ToInt32(pd.ToString("ddHHmmss")) | 15) | (1309 | 20);

            List <byte> lst = new List <byte>();

            lst.AddRange(Encoding.UTF8.GetBytes(header));
            lst.AddRange(Encoding.UTF8.GetBytes(pcc.ToLitString(6)));
            lst.AddRange(uid.ToByteArray());
            lst.AddRange(Encoding.UTF8.GetBytes(pd.ToString("yyyyMMddHHmmss")));
            lst.AddRange(Encoding.UTF8.GetBytes(body));

            var msg = Convert.ToBase64String(lst.ToArray());

            Console.WriteLine(msg);

            IPackage package = new ProxyPraser().Parse(msg);

            Console.WriteLine(package.UID);
            Console.WriteLine(package.IsValid());
        }
Exemple #2
0
        private void test()
        {
            string header = "07040202030300150000";
            Guid uid = Guid.NewGuid();
            DateTime pd = DateTime.Now;
            string body = "1.0.1.113092015winhyf你好出行者";
            int pcc = (Convert.ToInt32(pd.ToString("ddHHmmss")) | 15) | (1309 | 20);

            List<byte> lst = new List<byte>();
            lst.AddRange(Encoding.UTF8.GetBytes(header));
            lst.AddRange(Encoding.UTF8.GetBytes(pcc.ToLitString(6)));
            lst.AddRange(uid.ToByteArray());
            lst.AddRange(Encoding.UTF8.GetBytes(pd.ToString("yyyyMMddHHmmss")));
            lst.AddRange(Encoding.UTF8.GetBytes(body));

            var msg = Convert.ToBase64String(lst.ToArray());
            Console.WriteLine(msg);

            IPackage package = new ProxyPraser().Parse(msg);
            Console.WriteLine(package.UID);
            Console.WriteLine(package.IsValid());
        }