/// <summary> /// /// </summary> /// <param name="path"></param> /// <returns></returns> public static ResData LoadTextAsset(string path) { Debuger.Log("MFResources.LoadTextAsset " + path); ResData data = null; try { data = new ResData(path, typeof(TextAsset)); } catch (System.Exception e) { string msg = "[InnerException:]" + e.InnerException + "[Exception:]" + e.Message + "[Source:]" + e.Source + "[StackTrace:]" + e.StackTrace; //MFUIAlertManager.Instance.ShowNotifyView(path + "File Not Find", 2.0f); } text.Add(data); return data; }
IEnumerator ReqeustSignIn() { List <IMultipartFormSection> formData = new List <IMultipartFormSection>(); formData.Add(new MultipartFormDataSection("username", id)); formData.Add(new MultipartFormDataSection("input_password", pw)); UnityWebRequest webRequest = UnityWebRequest.Post("http://52.78.94.149:80/api/v1/users/signin/", formData); yield return(webRequest.SendWebRequest()); if (webRequest.isNetworkError || webRequest.isHttpError) { Debug.Log(webRequest.error); // pop up?? } else { Debug.Log("Form upload complete!"); string result = webRequest.downloadHandler.text; Debug.Log("Response: " + result); ResData d = JsonUtility.FromJson <ResData>(result); string user_pk = d.id; string user_id = d.username; string user_name = d.name; sm = playerStatus.GetComponent <StatusManagerStart>(); sm.user_pk = user_pk; sm.Call(); } }
// Update is called once per frame void Update() { if (ResLoadQue.Count > 0) { //有资源需要加载 if (!m_isPacketProcessing) { //开始加载资源 curLoadRes = ResLoadQue.Dequeue(); m_isPacketProcessing = true; Libs.AssetBundleManagar.getInstance().Load(curLoadRes.bundleName, OnLoadAssetBundle); } } //控制特效是否需要关闭 foreach (var effectList in effectDic) { for (int i = 0; i < effectList.Value.Count; ++i) { if (!effectList.Value[i].effectObj.activeSelf) { continue; } if (Time.time - effectList.Value[i].startTime > effectList.Value[i].endTime + 0.5f) { effectList.Value[i].effectObj.SetActive(false); } } } }
public JsonResult Create(string Content, int Level, string AnswerA, string AnswerB, string AnswerC, string AnswerD, int IsResult) { ResData res = new ResData(); if (String.IsNullOrEmpty(Content)) { res.ID = -1; res.Desc = "Nội dung câu hỏi không được để trống"; } else if (String.IsNullOrEmpty(AnswerA) || String.IsNullOrEmpty(AnswerB) || String.IsNullOrEmpty(AnswerC) || String.IsNullOrEmpty(AnswerD)) { res.ID = -2; res.Desc = "Đáp án không được để trống"; } else { res.ID = QuestionM.Create(Content, Level, AnswerA, AnswerB, AnswerC, AnswerD, IsResult); if (res.ID == 1) { res.Desc = "Thêm mới thành công"; } else { res.Desc = "Thêm mới thất bại"; } } return(Json(res)); }
public void LoadSkillEffect(int _effectId, bool _isPlay, Transform _pos) { //读取配置表 加载特效名 CSVFile _config = CVS.Instance.getFile("Effect"); if (_config == null) { return; } string path_str = _config.GetDataByIdAndName(_effectId, "ActionSpecialEffects"); if (path_str.Length <= 0) { return; } string[] pathArr = path_str.Split('|'); if (pathArr.Length > 0) { ResData _res = new ResData(); _res.effectId = _effectId; _res.bundleName = pathArr[0] + ".effect"; _res.resName = pathArr[1]; _res.playPos = _pos; _res.loadAndPlay = _isPlay; _res.endTime = _config.GetDataByIdAndNameToFloat(_effectId, "StopTime") / 1000; ResLoadQue.Enqueue(_res); } }
public HttpResponseMessage GetListPrize() { ResData res = new ResData(); try { List <PrizeMoney> lst = PlayM.GetListPrize(); if (lst != null && lst.Count() > 0) { res.Code = 1; res.Message = "Lấy dữ liệu OK"; res.Detail = lst; res.StatusCode = HttpStatusCode.OK; } else { res.Code = -1; res.Message = "Không có dữ liệu"; res.Detail = lst; res.StatusCode = HttpStatusCode.NonAuthoritativeInformation; } } catch (Exception ex) { res.Code = -99; res.Message = ex.Message; res.StatusCode = HttpStatusCode.BadRequest; } return(Request.CreateResponse(res.StatusCode, res)); }
public HttpResponseMessage GetMoney(ReqData req) { ResData res = new ResData(); try { var Content = JsonConvert.DeserializeObject <dynamic>(req.Content.ToString()); string QuestionLevel = Content.QuestionLevel.ToString(); string money = PlayM.GetMoney(QuestionLevel); res.Code = 1; res.Message = "Thành công"; res.Detail = money; res.StatusCode = HttpStatusCode.OK; } catch (Exception ex) { res.Code = -99; res.Message = ex.Message; res.StatusCode = HttpStatusCode.BadRequest; } return(Request.CreateResponse(res.StatusCode, res)); }
public HttpResponseMessage Create(ReqData req) { ResData res = new ResData(); try { var data = JsonConvert.DeserializeObject <dynamic>(req.Content.ToString()); //string Content, int Level, string AnswerA, string AnswerB, string AnswerC, string AnswerD, int IsResult string Content = data.Content.ToString(); string Level = data.Level.ToString(); string AnswerA = data.AnswerA.ToString(); string AnswerB = data.AnswerB.ToString(); string AnswerC = data.AnswerC.ToString(); string AnswerD = data.AnswerD.ToString(); string IsResult = data.IsResult.ToString(); int check = QuestionM.Create(Content, Level, AnswerA, AnswerB, AnswerC, AnswerD, IsResult); res.Code = 1; res.Message = "Thành công"; res.Detail = check; res.StatusCode = HttpStatusCode.OK; } catch (Exception ex) { res.Code = -99; res.Message = ex.Message; res.StatusCode = HttpStatusCode.BadRequest; } return(Request.CreateResponse(res.StatusCode, res)); }
public HttpResponseMessage GetQuestionLevel(ReqData req) { ResData res = new ResData(); try { var Content = JsonConvert.DeserializeObject <dynamic>(req.Content.ToString()); int Level = int.Parse(Content.Level.ToString()); QuestionM QM = QuestionM.GetQuestionLevel(Level); if (QM.QuestionID > 0) { res.Code = 1; res.Message = "Lấy dữ liệu OK"; res.Detail = QM; res.StatusCode = HttpStatusCode.OK; } else { res.Code = -1; res.Message = "Không có dữ liệu"; res.Detail = QM; res.StatusCode = HttpStatusCode.NonAuthoritativeInformation; } } catch (Exception ex) { res.Code = -99; res.Message = ex.Message; res.StatusCode = HttpStatusCode.BadRequest; } return(Request.CreateResponse(res.StatusCode, res)); }
public HttpResponseMessage Support5050(ReqData req) { ResData res = new ResData(); try { var Content = JsonConvert.DeserializeObject <dynamic>(req.Content.ToString()); string QuestionID = Content.QuestionID.ToString(); string support = PlayM.Support5050(QuestionID); res.Code = 1; res.Message = "Thành công"; res.Detail = support; res.StatusCode = HttpStatusCode.OK; } catch (Exception ex) { res.Code = -99; res.Message = ex.Message; res.StatusCode = HttpStatusCode.BadRequest; } return(Request.CreateResponse(res.StatusCode, res)); }
//发布招领信息 public ResData <Release> releaseGoods(t_lostgoods data) { ResData <Release> res = new ResData <Release>(); try { //增加一行记录 dbcontext.Add(data); //保存到数据库 int row = dbcontext.SaveChanges(); if (row > 0) { res.code = 1; res.msg = "发布成功"; Release release = new Release(); release.id = data.id; res.data = release; } else { res.code = -1; res.msg = "发布失败"; } } catch (Exception ex) { res.code = -1; res.msg = "发布失败:" + ex.Message; } return(res); }
public void query() { string parm = string.Empty; parm = parm + "goods=" + this.textBox1.Text; parm = parm + "&describe=" + this.textBox2.Text; parm = parm + "&bdate=" + this.dateTimePicker1.Text; parm = parm + "&edate=" + this.dateTimePicker2.Text; string strRes = HttpHelp.Http("GET", @"/api/Goods/Get", parm); if (string.IsNullOrEmpty(strRes)) { MessageBox.Show("网络请求有误,请重试!"); } else { ResData <List <GoodsId> > res = JsonConvert.DeserializeObject <ResData <List <GoodsId> > >(strRes); if (res.code == -1) { MessageBox.Show(res.msg); } else { this.dataGridView1.DataSource = res.data; } } }
public override T LoadAsset <T>(string name) { T asset = null; ResData resData = null; if (resFailedMap.TryGetValue(name, out resData)) { return(null); } if (resMap.TryGetValue(name, out resData)) { resData.RefCount++; asset = resData.Asset as T; } else { string path = ResPathConfig.GetABName(name); if (string.IsNullOrEmpty(path)) { Log.error("没有找到包含资源{0}的AssetBundle!", name); return(null); } /*AssetHandler loader = AssetHandler.Instance.LoadAssetBundle(path, ResPathConfig); * resData = resDataPool.Get(); * resData.Name = name; * resData.RefCount++; * resMap.Add(name, resData); * asset = loader.LoadAsset<T>(name); * resData.LoadSuccess(loader, asset);*/ } return(asset); }
public HttpResponseMessage GetListHistory(ReqData req) { ResData res = new ResData(); try { var Content = JsonConvert.DeserializeObject <dynamic>(req.Content.ToString()); string AccountID = Content.AccountID.ToString(); List <HistoryM> history = HistoryM.GetListHistory(AccountID); if (history != null && history.Count > 0) { res.Code = 1; res.Message = "Thành công"; res.Detail = history; res.StatusCode = HttpStatusCode.OK; } else { res.Code = -1; res.Message = "Thông thành công"; res.Detail = history; res.StatusCode = HttpStatusCode.NonAuthoritativeInformation; } } catch (Exception ex) { res.Code = -99; res.Message = ex.Message; res.StatusCode = HttpStatusCode.BadRequest; } return(Request.CreateResponse(res.StatusCode, res)); }
public JsonResult CapNhatVanDe() { IssueModel IM = new IssueModel(); IM.VanDeID = Int32.Parse(Request.Form["VanDeID"].ToString()); IM.DuAnID = Int32.Parse(Request.Form["DuAnID"].ToString()); IM.LoaiVanDeID = Int32.Parse(Request.Form["LoaiVanDe"].ToString()); IM.TenVanDe = Request.Form["TenVanDe"].ToString(); IM.MoTa = Request.Form["MoTa"].ToString(); IM.TrangThai = Int32.Parse(Request.Form["TrangThai"].ToString()); IM.NguoiThucHien = Request.Form["NguoiThucHien"].ToString(); IM.NgayBatDau = Request.Form["NgayBatDau"].ToString(); IM.NgayKetThuc = Request.Form["NgayKetThuc"].ToString(); IM.SoGioDuKien = Int32.Parse(Request.Form["SoGioDuKien"].ToString()); IM.SoGioThucTe = Int32.Parse(Request.Form["SoGioThucTe"].ToString()); IM.NguoiCapNhat = Session["UserName"].ToString(); ResData res = IssueModel.CapNhatVanDe(IM); if (res.ResultID > 0) { SendMail(res.ResultVanDeID, res.ResultID); } return(Json(res, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 释放所有下载的请求资源 /// </summary> /// <param name="url"></param> private void ReleaseAllRequest() { foreach (WWWRequest request in processingRequest.Values) { request.Dispose(); } for (int i = 0; i < DownLoadFiles.Count; i++) { ResData resData = DownLoadFiles[i]; string resName = resData.name; if (succeedRequest.ContainsKey(resName)) { succeedRequest[resName].Dispose(); continue; } if (failedRequest.ContainsKey(resName)) { failedRequest[resName].Dispose(); } } DownLoadFiles.Clear(); processingRequest.Clear(); succeedRequest.Clear(); failedRequest.Clear(); }
public ResData LoadResource(string _strPath) { ResData data = new ResData(); if (File.Exists(_strPath)) { using (var file = File.OpenRead(_strPath)) { long filesize = file.Length; byte[] fbin = new byte[filesize]; file.BeginRead(fbin, 0, (int)filesize, ar => { int bytesRead = file.EndRead(ar); if (bytesRead == (int)filesize) { data.m_pBins = fbin; data.m_strCrc = Crc32.CountCrc(fbin).ToString(); } else { Debug.LogError("Read File Fail!"); } }, null); } } else { Debug.LogError(" File Dont Found!"); } return(data); }
public ResData UpUserInfo([FromForm] string pwd, [FromForm] string pwdOld, [FromForm] string Code) { var user = ""; user = GetCookies("userid"); if (user != "") { var li = EF.UserInfos.FirstOrDefault(a => a.UserID == user); //var Pwd = MD5Helper.EncryptString(pwd); //var PwdOld = MD5Helper.EncryptString(pwdOld); if (li.PassWord == pwdOld) { if (Code == GetCookies("yz")) { var up = personalI.UpdataUser(pwd, user); return(GetUser()); } else { return(ResData.Succ(_msg: "验证码错误")); } } else { return(ResData.Succ(_msg: "密码错误")); } } else { return(ResData.Fail()); } }
/// <summary> /// 创建版本下载队列 /// </summary> /// <param name="processCallback"></param> private void CreateVersionTaskQueue(ResData res, string writeTo, Action <bool> processCallback) { string curDownloadPath = "http://" + srdata.server_resource_online + "/" + res.path_resource; var versiontask = HttpMgr.Task.Create(curDownloadPath + "/" + GetPlatformName() + "/" + "VersionHash.xml", null, (HttpMgr.Task task, WWW w) => { Debug.Log("下载资源:" + task.url); if (w.error != null) { //写入 if (File.Exists(writeTo)) { File.Delete(writeTo); } File.WriteAllBytes(writeTo, w.bytes); processCallback(true); } else { Debug.Log("服务端没有资源,请检查是否是第一次生成,或者忘了提交"); processCallback(true); return; } }); HttpMgr.Instance.GetLayer((uint)HttpLayer.HotUpdate).QueueTask(versiontask); }
/// <summary> /// 解析服务端返回数据 /// </summary> /// <param name="s"></param> /// <returns></returns> private bool ParseJson(string s) { try { var json = MyJson.Parse(s); srdata.http_code = json.asDict()["http_code"].AsString(); srdata.name = json.asDict()["data"].asDict()["name"].AsString(); srdata.version_latest = json.asDict()["data"].asDict()["version_latest"].AsString(); srdata.ver_res_latest = json.asDict()["data"].asDict()["ver_res_latest"].AsString(); srdata.server_resource_online = json.asDict()["data"].asDict()["server_resource_online"].AsString(); srdata.server_resource_online_ip = json.asDict()["data"].asDict()["server_resource_online_ip"].AsString(); srdata.server_resource_local_ip = json.asDict()["data"].asDict()["server_resource_local_ip"].AsString(); foreach (var _j in json.asDict()["data"].asDict()["resource"].AsList()) { ResData res = new ResData(); res.version_res_current = _j.asDict()["version_res_current"].AsString(); res.version_res_next = _j.asDict()["version_res_next"].AsString(); res.path_resource = _j.asDict()["path_resource"].AsString(); res.force_update = _j.asDict()["force_update"].AsString(); res.status = _j.asDict()["status"].AsString(); srdata.resource.Add(res); } return(true); } catch { return(false); } }
//发布招领信息 public ResData <Release> releaseGoods(Goods data) { ResData <Release> res = new ResData <Release>(); //判断请求的数据是否合法 if (string.IsNullOrEmpty(data.goods) || string.IsNullOrEmpty(data.describe) || string.IsNullOrEmpty(data.contact_man)) { res.code = -1; res.msg = "物品名称、物品描述、联系人不能为空"; } else if (string.IsNullOrEmpty(data.contact_phone) && string.IsNullOrEmpty(data.contact_email)) { res.code = -1; res.msg = "必须输入一种联系方式(手机号码/EMAIL)"; } else { //从接口请求过来的数据赋值给数据库的表对象 t_lostgoods lostgoods = new t_lostgoods(); lostgoods.id = long.Parse(DateTime.Now.ToString("yyyyMMddhhmmss")); lostgoods.goods = data.goods; lostgoods.describe = data.describe; lostgoods.collect_date = data.collect_date; lostgoods.collect_addr = data.collect_addr; lostgoods.contact_man = data.contact_man; lostgoods.contact_phone = data.contact_phone; lostgoods.contact_email = data.contact_email; res = lostGoodsDal.releaseGoods(lostgoods); } return(res); }
private IEnumerator WWWDownLoad(string url, string filePath, int index) { ResData downLoadDataInfo = downLoadingDataInfoArray[index]; if (downLoadDataInfo != null) { float time = Time.realtimeSinceStartup; string downUrl = serverurl + url; WWW www = new WWW(Uri.EscapeUriString(downUrl)); yield return(www); mDownLoadedIndex++; if (string.IsNullOrEmpty(www.error)) { try { byte[] bBuffer = www.bytes; int nRealReadCount = bBuffer.Length; FileStream filestream = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite); try { filestream.Position = 0L; filestream.Write(bBuffer, 0, nRealReadCount); filestream.Flush(); filestream.Close(); } finally { if (filestream != null) { filestream.Dispose(); } } //下载完之后开始文件拷贝 FileInfo finfo = new FileInfo(filePath); string targetpath = string.Format("{0}{1}", mLocalDataFolder, downLoadDataInfo.mDataPath); string directoryName = Path.GetDirectoryName(targetpath); if (!Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } if (File.Exists(targetpath)) { File.Delete(targetpath); } finfo.MoveTo(targetpath); FileDownLoaded(index.ToString()); GameDebug.Log("copy time = " + ((Time.realtimeSinceStartup - time)).ToString("0.000") + "s, url = " + downUrl); } catch (Exception exception) { GameDebug.LogError("url = " + url + ", filePath = " + filePath + ", " + exception.ToString()); } } } }
public JsonResult CapNhatTinhTrang(int VanDeID) { ResData res = new ResData(); res = IssueModel.CapNhatTinhTrang(VanDeID, Session["Username"].ToString()); return(Json(res, JsonRequestBehavior.AllowGet));; }
public static ResultData UploadFileToServer(string filekey, string fpath, FileTypeDirEnum dir, bool isOverride, Action <int> proAction) { ResultData result = new ResultData(); //设置账号的AK和SK Qiniu.Conf.Config.ACCESS_KEY = QiniuConfig.AccessKey; Qiniu.Conf.Config.SECRET_KEY = QiniuConfig.SecretKey; IOClient target = new IOClient(); target.ProgressHandler += (x, y) => { proAction?.Invoke(y.Progress); }; PutExtra extra = new PutExtra(); //设置上传的空间 string bucket = QiniuUtil.GetServerBucket(dir); //设置上传的文件的key值 string key = filekey; //覆盖上传,<bucket>:<key>,表示只允许用户上传指定key的文件。在这种格式下文件默认允许“修改”,已存在同名资源则会被本次覆盖。 PutPolicy put = new PutPolicy(bucket, 3600); if (isOverride) { put = new PutPolicy(string.Format("{0}:{1}", bucket, key)); } //VideoWaterMark(put, key, bucket); //调用Token()方法生成上传的Token string upToken = put.Token(); //上传文件的路径 string filePath = fpath; //调用PutFile()方法上传 PutRet ret = target.PutFile(upToken, key, filePath, extra); //打印出相应的信息 string json = ret.Response.ToString(); if (json.Contains("hash") && json.Contains("key")) { ResData user = (ResData)JsonConvert.DeserializeObject(json, typeof(ResData)); result.HashCode = user.hash; result.IsSuccess = true; result.Key = user.key; result.FullUrl = QiniuUtil.GetFullUrl(user.key, dir); } else { result.IsSuccess = false; var resData = (ErrData)JsonConvert.DeserializeObject(json, typeof(ErrData)); result.ErrCode = resData.code; result.ErrMsg = resData.error; } return(result); }
public HttpResponseMessage Register(ReqData req) { ResData res = new ResData(); try { var Content = JsonConvert.DeserializeObject <dynamic>(req.Content.ToString()); string Fullname = Content["Fullname"].ToString(); string Username = Content["Username"].ToString(); string Password = Content["Password"].ToString(); int RegisRes = AccountM.Register(Fullname, Username, Password); if (RegisRes == 1) { res.Code = 1; res.Message = "Đăng ký thành công"; res.Detail = req.Content; res.StatusCode = HttpStatusCode.OK; } else if (RegisRes == 2) { res.Code = 2; res.Message = "Tên đăng nhập đã tồn tại"; res.Detail = req.Content; res.StatusCode = HttpStatusCode.OK; } else if (RegisRes == 3) { res.Code = 3; res.Message = "Họ và tên không được để trống"; res.Detail = req.Content; res.StatusCode = HttpStatusCode.OK; } else if (RegisRes == 4) { res.Code = 4; res.Message = "Tên đăng nhập không được để trống"; res.Detail = req.Content; res.StatusCode = HttpStatusCode.OK; } else if (RegisRes == 5) { res.Code = 5; res.Message = "Mật khẩu không được để trống"; res.Detail = req.Content; res.StatusCode = HttpStatusCode.OK; } } catch (Exception ex) { res.Code = -99; res.Message = ex.Message; res.StatusCode = HttpStatusCode.BadRequest; } return(Request.CreateResponse(res.StatusCode, res)); }
public static ResData LoadGameObject(string path) { Debuger.Log("MFResources.LoadGameObject " + path); ResData data = new ResData(path, typeof(GameObject)); go.Add(data); return data; }
public object Yz(string email) { var userid = ""; if (GetCookies("userid") != "") { userid = GetCookies("userid"); } else { return(ResData.Fail("未登录")); } Random random = new Random(Guid.NewGuid().GetHashCode()); string intString = random.Next(1000, 9999).ToString(); HttpContext.Response.Cookies.Append("yz", intString, new CookieOptions { Expires = DateTime.Now.AddMinutes(3) }); // 确定smtp服务器地址 实例化一个Smtp客户端 SmtpClient client = new SmtpClient(); client.Host = options.Value.Host; // 确定发件地址与收件地址 MailAddress sendAddress = new MailAddress(options.Value.Address, options.Value.Name, System.Text.Encoding.Default); MailAddress receiveAddress = new MailAddress(email); // 构造一个Email的Message对象 内容信息 MailMessage mailMessage = new MailMessage(sendAddress, receiveAddress); mailMessage.Subject = "登陆验证码"; mailMessage.SubjectEncoding = System.Text.Encoding.UTF8; mailMessage.IsBodyHtml = true; mailMessage.Body = "嗨喽,终于等到您啦!<br/><br/>欢迎修改宁的邮箱密码,您的验证码为:<span style=font-weight:bold;font-size:18px;'>" + intString + "</span><br/>(5分钟内有效)<br/><br/>工作人员不会向您索要密码、验证码等信息。如非本人操作,请联系我们或忽略本条信息。<br/><br/>"; mailMessage.BodyEncoding = System.Text.Encoding.UTF8; mailMessage.Priority = MailPriority.Low;//优先级 // 邮件发送方式 通过网络发送到smtp服务器 client.DeliveryMethod = SmtpDeliveryMethod.Network; // 如果服务器支持安全连接,则将安全连接设为true client.EnableSsl = true; try { // 是否使用默认凭据,若为false,则使用自定义的证书,就是下面的networkCredential实例对象 client.UseDefaultCredentials = false; // 指定邮箱账号和密码,需要注意的是,这个密码是你在QQ邮箱设置里开启服务的时候给你的那个授权码 NetworkCredential networkCredential = new NetworkCredential(options.Value.Address, options.Value.Password); client.Credentials = networkCredential; // 发送邮件 client.Send(mailMessage); return(ResData.Succ("发送成功")); } catch { return(ResData.Fail("发送失败")); } }
public void AddDownLoadFile(ResData data) { if (DownLoadFiles.Contains(data)) { Debug.LogWarning("Down load file already exist! name:" + data.name); return; } DownLoadFiles.Add(data); }
public ResData meiyoude([FromForm] string list) { //Newtonsoft.Json var a4 = Newtonsoft.Json.JsonConvert.DeserializeObject <List <ShoppingCar> >(list); return(ResData.Succ(list)); }
public ResData Regi([FromForm] UserInfo user, [FromForm] string yz) { var sds = GetCookies("yz"); if (yz != sds) { return(ResData.Succ()); } return(ResData.Succ()); }
public void Start(string gameid, string localversion, string sine, string writeTo, Action <bool> processCallback) { if (mResServerAddress == null) { Debug.Log("请设置服务器地址"); return; } //请求资源服务器 var md5 = HashHelper.CreateMD5Hash(string.Format("gameid={0}&version_res={1}{2}", gameid, localversion, sine)); Debug.Log(md5); var path = string.Format("{0}?gameid={1}&version_res={2}&sign={3}", mResServerAddress, gameid, localversion, md5); //创建请求接入服务器 var t = HttpMgr.Task.Create(path, null, (HttpMgr.Task task, WWW w) => { Debug.Log("下载:" + task.url); if (w.error != null) { ResData data = null; if (ParseJson(System.Text.Encoding.UTF8.GetString(w.bytes))) { foreach (var m in srdata.resource) { if (m.version_res_current == m.version_res_next) { data = m; break; } } // if (data != null) { CreateVersionTaskQueue(data, writeTo, processCallback); } } else { processCallback(false); } } else { processCallback(true); Debug.LogError(w.error); } }); // HttpMgr.Instance.GetLayer((uint)HttpLayer.HotUpdate).QueueTask(t); return; }
public object Test([FromForm] string token) { if (LoginUser == null) { return(ResData.Fail()); } else { return(ResData.Succ()); } }