Exemple #1
0
 public override bool ParseStream(NetworkStream ns)
 {
     try
     {
         if (!ns.DataAvailable)
         {
             return(false);
         }
         int    len  = (ns.ReadByte() << 24) + (ns.ReadByte() << 16) + (ns.ReadByte() << 8) + ns.ReadByte();
         byte[] data = new byte[len];
         byte[] head = new byte[4];
         ns.Read(head, 0, 4);
         ns.Read(data, 0, len);
         MyAuxiliary.OutPut(Inspector.Inspect(data));
         if (data[0] == 10 && data[1] == 11 && data[2] == 1 && data[3] == 7)
         {
             CNameObjDict co = ((CNameObjDict)CAmf3Helper.GetObject(data));
             MyAuxiliary.OutPut(co.ToString());
             ParseData(co);
         }
         else
         {
             return(true);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
     }
     return(true);
 }
Exemple #2
0
        public CNameObjDict ParseAMF3(byte[] data)
        {
            CNameObjDict co = null;

            try
            {
                co = ((CNameObjDict)CAmf3Helper.GetObject(data));
            }
            catch (Exception e) {
                MessageBox.Show(e.Message);
                return(null);
            }

            return(co);
        }
Exemple #3
0
        //login funs end



        public byte[] packetData(object o)
        {
            byte[]       buf3 = CAmf3Helper.GetBytes(o);
            int          len  = buf3.Length;
            MemoryStream ms   = new MemoryStream();

            ms.WriteByte((byte)(len >> 24 & 0xff));
            ms.WriteByte((byte)(len >> 16 & 0xff));
            ms.WriteByte((byte)(len >> 8 & 0xff));
            ms.WriteByte((byte)(len & 0xff));
            ms.WriteByte(1);
            ms.WriteByte(0);
            ms.WriteByte(1);
            ms.WriteByte(1);
            MD5 md5 = MD5.Create();

            ms.Write(md5.ComputeHash(yihuo(buf3)), 0, 16);
            ms.Write(buf3, 0, len);

            return(ms.ToArray());
        }
Exemple #4
0
        //1
        public void Login(Dictionary <string, string> hash)
        {
            Dictionary <string, object> login = new Dictionary <string, object>();

            login["method"]   = "user.login";
            login["callback"] = getObject("callbackName", "user.login");
            login["token"]    = config.token;
            object[] args = new object[2];
            //hash["forumURL"] = "http://mapifknsg.zuiyouxi.com/";
            // hash["pay_url"] = "http://mapifknsg.zuiyouxi.com/";
            // hash["bbsUrl"] = "http://mapifknsg.zuiyouxi.com/";
            // hash["forumURL"] = "http://mapifknsg.zuiyouxi.com/";
            args[0]       = hash;
            args[1]       = "publish=" + config.publishVersion + ", script=" + config.scriptVersion + ", pl=" + config.pl + ", fixversion=" + config.fixVersion + ", sysName=" + config.sysName + ", sysVersion=" + config.sysVersion + ", deviceModel=" + config.deviceModel;
            login["args"] = args;

            byte[] buf3      = CAmf3Helper.GetBytes(login);
            object readBack3 = CAmf3Helper.GetObject(buf3);

            //O(readBack3.ToString());
            //O(Inspector.Inspect(packetData(login)));
            engine = new SocketEngine(this, ((string[])config.serverlist[config.serverindex])[1], int.Parse(((string[])config.serverlist[config.serverindex])[2]));
            engine.SendData(packetData(login));
        }