//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()); }
//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)); }