public static string querygateway(string ip, string port, string session, string modename, string querystr) { string url = string.Format(@"http://{0}:{1}/{2}", ip, port, modename); string data = string.Format(@"session_id={0}{1}", session, querystr); string result = CommMeth.HttpPost(data, url); result = CommMeth.FormatJsonStr(result); //ResultLoginServer resultmodel = CommMeth.JsonDeserialize<ResultLoginServer>(result); return(result); }
public static string getuserinfo(string ip, string port, string session, string type) { string url = string.Format(@"http://{0}:{1}/get_user_info", ip, port); string data = string.Format(@"session_id={0}&info_type={1}", session, type); string result = CommMeth.HttpPost(data, url); result = CommMeth.FormatJsonStr(result); //ResultLoginServer resultmodel = CommMeth.JsonDeserialize<ResultLoginServer>(result); return(result); }
/// <summary> /// 登陆后的后续操作,具体结构待定 /// </summary> /// <param name="url"></param> /// <param name="session_id"></param> /// <param name="paramstr"></param> /// <returns></returns> public static string OP(string url, string session_id, string paramstr) { if (string.IsNullOrWhiteSpace(url) || string.IsNullOrWhiteSpace(session_id)) { return(null); } string data = string.Format("session_id={0}&{1}", session_id, paramstr); return(CommMeth.HttpPost(data, url)); }
/// <summary> /// 登陆选择服务器 /// </summary> /// <param name="uin">玩家id</param> /// <param name="token">验证码</param> /// <param name="si">服务器信息</param> /// <returns></returns> public static string login_server(int uin, string token, server_info si) { if (si == null) { return(null); } string url = string.Format(@"http://{0}:{1}/login", si.ip, si.port); string mdstr = string.Format(@"uin={0}&token={1}{2}", uin, token, signkey); string encode = CommMeth.MD5Encrypt(mdstr).ToLower(); string data = string.Format("uin={0}&token={1}&sign={2}", uin, token, encode); string result = CommMeth.HttpPost(data, url); return(CommMeth.FormatJsonStr(result)); }
//public static void GetTTYpe<T>(T aa) //{ // var aaa = typeof(T).GetGenericArguments(); // switch(aaa.ToString()) // { // case (aa.GetType()).ToString(): // { // } // break; // } //} /// <summary> /// 登陆 /// </summary> /// <param name="tp">登陆模式 0.游客登陆 1.平台登陆</param> /// <param name="Dev">设备号</param> /// <param name="Plat">平台</param> /// <param name="version">版本号</param> /// <param name="Id">玩家ID(游客登陆时可为空)</param> /// <param name="Name">玩家名(游客登陆时可为空)</param> /// <returns></returns> public static string login(string tp, string Dev, string Plat, string version, string Id, string Name) { string url = urlroot + "login"; string data = string.Format("tp={0}&dev={1}&plat={2}&version={3}&Id={4}&Name={5}", tp, Dev, Plat, version, Id, Name); try { return(CommMeth.HttpPost(data, url)); } catch { return(null); } }