public IEnumerator Speak(string text) { string apikey = "574d2e7369414131537a42783455734c73696c575870434262616373483252382e71466c6d587446776738"; //string url = "https://api.apigw.smt.docomo.ne.jp/aiTalk/v1/textToSpeech?APIKEY=" + apikey; string url = "https://api.apigw.smt.docomo.ne.jp/crayon/v1/textToSpeechSsml?APIKEY=" + apikey; string path = Application.dataPath; Dictionary <string, string> aiTalksParams = new Dictionary <string, string>(); postData postdata = new postData(); postdata.Command = "AP_Synth"; postdata.StyleID = "1"; postdata.SpeakerID = "1"; postdata.SpeechRate = "1.00"; postdata.VoiceType = "1"; postdata.AudioFileFormat = "2"; postdata.TextData = createSSML(text); string data = JsonUtility.ToJson(postdata); var PostData = System.Text.Encoding.UTF8.GetBytes(data); UnityWebRequest www = new UnityWebRequest(url, "POST"); www.uploadHandler = (UploadHandler) new UploadHandlerRaw(PostData); www.downloadHandler = (DownloadHandler) new DownloadHandlerBuffer(); www.SetRequestHeader("Content-Type", "application/json"); yield return(www.Send()); if (File.Exists(path + "/Voice/Speak.wav")) { yield return(textSave(www.downloadHandler.data, text)); } using (WWW ww = new WWW("file:///" + path + "/Voice/Speak.wav")){ yield return(ww); audioClip = ww.GetAudioClip(); if (audioClip == null) { Debug.Log("Not exit"); } else { AudioSource audioSource = this.GetComponent <AudioSource>(); audioSource.clip = audioClip; audioSource.Play(); } } yield return(null); //InitSaveData(); }
public IActionResult GetDetail(postData enParam) { var principal = GetPrincipalFromExpiredToken(enParam.token); var username = principal.Identity.Name; var xxx = principal.Claims; string sid = xxx.Where(c => c.Type == ClaimTypes.Sid).Select(c => c.Value).SingleOrDefault(); string password = xxx.Where(c => c.Type == ClaimTypes.SerialNumber).Select(c => c.Value).SingleOrDefault(); return(new ObjectResult(new { name = principal.Identity.Name })); }
private static postData[] parsePostData(JObject downloadedData) { if (downloadedData.First == null) { return(new postData[0]); } List <postData> parsedData = new List <postData>(); foreach (JToken post in downloadedData["data"]["children"].Children()) { if (post == null) { continue; } postData parsedPost = new postData { url = post["data"]["url"].Value <string>(), author = post["data"]["author"].Value <string>(), commentCount = post["data"]["num_comments"].Value <int>(), gilded = post["data"]["gilded"].Value <int>(), nsfw = post["data"]["over_18"].Value <bool>(), postTitle = post["data"]["title"].Value <string>(), score = post["data"]["score"].Value <int>(), subreddit = post["data"]["subreddit"].Value <string>(), timeCreated = post["data"]["created"].Value <int>(), urlDomain = post["data"]["domain"].Value <string>() }; if (parsedPost.url.Contains("reddit.com")) { parsedPost.postBody = post["data"]["selftext"].Value <string>(); } parsedPost = IDPost(parsedPost); parsedData.Add(parsedPost); } return(parsedData.ToArray()); }
public ServiceResponse DeleteServiceTypes(postData data) { ServiceResponse SR = new ServiceResponse(); List <VSR_Mst_ServiceTypes_GetAll_Result> ServiceType = new List <VSR_Mst_ServiceTypes_GetAll_Result>(); try { db.VSR_Mst_ServiceTypes_Delete(data.serviceTypeId); ServiceType = db.VSR_Mst_ServiceTypes_GetAll().ToList(); if (ServiceType.Count() > 0) { SR.status = 1; SR.ServiceTypes = ServiceType; SR.message = "Deleted Successfully!!"; } return(SR); } catch { SR.message = "Error Occured "; SR.ServiceTypes = ServiceType; SR.status = 0; return(SR); } }
private static postData IDPost(postData post) { if (post.url.Contains("i.redd.it") || post.url.Contains("i.imgur")) //If the url can be used directly to download the media { post.type = postTypes.image; } else if (post.url.Contains("imgur")) //If the imgur api is needed to get the image/gif { post.type = postTypes.imgur; } else if (post.url.Contains("gfycat")) //If the url needs to be modified to download a gfycat gif { post.type = postTypes.gif; } else if (post.url.Contains("reddit") && !post.url.Contains("/r/")) //if the url points to a reddit comment thread, it is just a text post { post.type = postTypes.text; } else //if the url is something else, it could be just a link to another website (will be ignored/not downloaded) { post.type = postTypes.linkOrOther; } return(post); }
/// <summary> /// 向微信请求游戏虚拟手柄小程序的二维码图片信息. /// </summary> void HttpRequestWeiXinXiaoChengXuErWeiMa(WeiXinXiaoChengXuData data) { string url = data.qrcodeUrl; Encoding encoding = Encoding.GetEncoding("utf-8"); postData postdata = new postData(); postdata.scene = data.scene; postdata.page = data.page; Debug.Log("HttpRequestWeiXinXiaoChengXuErWeiMa -> url ==== " + url); Debug.Log("HttpRequestWeiXinXiaoChengXuErWeiMa -> scene ==== " + postdata.scene); Debug.Log("HttpRequestWeiXinXiaoChengXuErWeiMa -> page ==== " + postdata.page); string str = JsonMapper.ToJson(postdata); byte[] postData = Encoding.UTF8.GetBytes(str); PostHttpResponse postHttpResponse = new PostHttpResponse(); HttpWebResponse response = postHttpResponse.CreatePostHttpResponse(url, postData, encoding); //打印返回值. Stream stream = null; //获取响应的流. try { //以字符流的方式读取HTTP响应. stream = response.GetResponseStream(); //System.Drawing.Image.FromStream(stream).Save(path); MemoryStream ms = null; byte[] buffer = new byte[response.ContentLength]; int offset = 0, actuallyRead = 0; do { actuallyRead = stream.Read(buffer, offset, buffer.Length - offset); offset += actuallyRead; }while (actuallyRead > 0); ms = new MemoryStream(buffer); byte[] buffurPic = ms.ToArray(); Debug.Log("Unity: buffurPic.length ==================== " + buffurPic.Length); string path = m_BoxLoginData.WX_XiaoChengXu_ErWeiMa_Path; Debug.Log("Unity: path ==== " + path); File.WriteAllBytes(path, buffurPic); } finally { //释放资源. if (stream != null) { stream.Close(); } if (response != null) { response.Close(); } } //更新微信小程序二维码. if (ErWeiMaUI.GetInstance() != null) { ErWeiMaUI.GetInstance().ReloadGameWXPadXiaoChengXuErWeiMa(); } }
public ListModel(IConfiguration config, postData postData) { this.config = config; this.postData = postData; }
public DetailModel(postData postData) { this.postData = postData; }
public IActionResult ajax(string ctrl, string postData) { string dir = "ajax.sword"; string path = ""; string str = ""; if (postData != null) { postData pd = JsonConvert.DeserializeObject <postData>(postData); string action = pd.ctrl.Split('?')[0]; JObject re_json; GDTXDate gd; Nsrxx xx; switch (action) { case "SB025YhssbCtrl_saveYhsSbxx": qc = set.getUserYSBQC(set.BDDM.Yhs); set.saveUserYSBQCReportData(pd.data, qc.Id.ToString(), qc.BDDM); GTXMethod.UpdateYSBQC(qc.Id.ToString(), set.SBZT.YSB); path = he.WebRootPath + "/" + dir + "/" + action + ".json"; str = System.IO.File.ReadAllText(path); break; case "SB151zlbsslCtrl_queryKjzdzzDmByDjxh": path = he.WebRootPath + "/" + dir + "/" + action + ".json"; str = System.IO.File.ReadAllText(path); re_json = JsonConvert.DeserializeObject <JObject>(str); gd = set.getGDTXDate(set.BDDM.XqykjzzCwbb); re_json["data"].Where(a => a["name"].ToString() == "ssqq").FirstOrDefault()["value"] = gd.skssqq; re_json["data"].Where(a => a["name"].ToString() == "ssqz").FirstOrDefault()["value"] = gd.skssqz; str = JsonConvert.SerializeObject(re_json); break; case "GY002CommonCtrl_queryNsrxxByNsrsbh": path = he.WebRootPath + "/" + dir + "/" + action + ".json"; str = System.IO.File.ReadAllText(path); re_json = JsonConvert.DeserializeObject <JObject>(str); gd = set.getGDTXDate(set.BDDM.XqykjzzCwbb); xx = set.getNsrxx(); JToken tds = re_json.SelectToken("data[1].trs[0].tds"); tds["nsrmc"]["value"] = xx.NSRMC; tds["fddbrsfzjhm"]["value"] = xx.IDCardNum; tds["bsrxm"]["value"] = xx.Name; str = JsonConvert.SerializeObject(re_json); break; case "SB025YhssbCtrl_reloadNsrzfhy": path = he.WebRootPath + "/" + dir + "/" + action + ".json"; str = System.IO.File.ReadAllText(path); re_json = JsonConvert.DeserializeObject <JObject>(str); xx = set.getNsrxx(); re_json.SelectToken("data").Where(a => a["name"].ToString() == "zhyMc").FirstOrDefault()["value"] = xx.GBHY; str = JsonConvert.SerializeObject(re_json); break; case "SB025YhssbCtrl_getDefaultJmxx": string zspmDm = pd.data.Where(a => a["name"].ToString() == "zspmDm").FirstOrDefault()["value"].ToString(); path = he.WebRootPath + "/" + dir + "/" + action + "." + zspmDm + ".json"; str = System.IO.File.ReadAllText(path); break; case "SB104xqykjzzcwbsCtrl_saveZcfzb": qc = set.getUserYSBQC(set.BDDM.XqykjzzCwbb); set.saveUserYSBQCReportData(pd.data, qc.Id.ToString(), qc.BDDM); path = he.WebRootPath + "/" + dir + "/" + action + ".json"; str = System.IO.File.ReadAllText(path); break; case "SBGyCtrl_jsskssqz": path = he.WebRootPath + "/" + dir + "/" + action + ".json"; str = System.IO.File.ReadAllText(path); re_json = JsonConvert.DeserializeObject <JObject>(str); gd = set.getGDTXDate(set.BDDM.Yhs); re_json["data"].Where(a => a["name"].ToString() == "skssqq").FirstOrDefault()["value"] = gd.skssqq; re_json["data"].Where(a => a["name"].ToString() == "skssqz").FirstOrDefault()["value"] = gd.skssqz; str = JsonConvert.SerializeObject(re_json); break; default: path = he.WebRootPath + "/" + dir + "/" + action + ".json"; str = System.IO.File.ReadAllText(path); break; } } else { path = he.WebRootPath + "/" + dir + "/" + ctrl + ".json"; str = System.IO.File.ReadAllText(path); } return(Content(str, "application/json;charset=utf-8")); }
public IActionResult form(string postData) { string dir = "form.sword"; string path = ""; postData pd = JsonConvert.DeserializeObject <postData>(postData); string str = ""; JObject re_json; Nsrxx xx = set.getNsrxx(); string action = pd.ctrl.Split('?')[0]; GDTXDate gd; Model model; switch (action) { case "SB151zlbsslCtrl_initBd": gd = set.getGDTXDate(set.BDDM.XqykjzzCwbb); model = new Model { Nsrxx = xx, GDTXDate = gd }; return(View(action, model)); case "SB025YhssbCtrl_cwgzInitView": path = he.WebRootPath + "/" + dir + "/" + action + ".SwordPageData.json"; str = System.IO.File.ReadAllText(path); re_json = JsonConvert.DeserializeObject <JObject>(str); gd = set.getGDTXDate(set.BDDM.Yhs); var q = from d in re_json["data"] where d["name"] != null && d["name"].ToString() == "nsrxxForm" select d; JToken nsrxxForm = q.FirstOrDefault(); JToken nsrxxForm_data = nsrxxForm["data"]; nsrxxForm_data["skssqq"]["value"] = gd.skssqq; nsrxxForm_data["skssqz"]["value"] = gd.skssqz; nsrxxForm_data["sbrq1"]["value"] = gd.tbrq; nsrxxForm_data["nsrsbh"]["value"] = xx.NSRSBH; nsrxxForm_data["nsrmc"]["value"] = xx.NSRMC; nsrxxForm_data["sfzjhm"]["value"] = xx.IDCardNum; q = from d in re_json["data"] where d["name"] != null && d["name"].ToString() == "slxxForm" select d; JToken slxxForm = q.FirstOrDefault(); JToken slxxForm_data = slxxForm["data"]; slxxForm_data["slrq"]["value"] = gd.tbrq; slxxForm_data["slswjg"]["value"] = xx.ZGDSSWJFJMC; slxxForm_data["bsr"]["value"] = xx.Name; qc = set.getUserYSBQC(set.BDDM.Yhs); JToken data_json = set.getUserYSBQCReportData(qc.Id, qc.BDDM); JToken yhssbGrid = data_json.Where(a => a["name"] != null && a["name"].ToString() == "yhssbGrid").FirstOrDefault(); yhssbGrid["name"] = "yhssbGridGz"; q = from d in re_json["data"] where d["name"] != null && d["name"].ToString() == "yhssbGridGz" select d; JToken yhssbGridGz = q.FirstOrDefault(); yhssbGridGz.Remove(); ((JArray)re_json["data"]).Add(yhssbGrid); model = new Model { data = JsonConvert.SerializeObject(re_json) }; return(View(action, model)); case "GYDrCtrl_openDr": return(View(set.functionNotOpen)); default: return(View(action)); } }
public EditModel(postData postData) { this.postData = postData; }
public CommentModel() { this.postData = postData; }