private string toJson(JsonInfo Info) { string tmp = string.Empty; if (Info.key != "" && Info.key != null) { tmp += '"' + Info.key + "\":"; } if (Info.type == ValueType.Array || Info.type == ValueType.Object) { if (Info.list != null) { tmp += Info.type == ValueType.Array ? "[" : "{"; int count = Info.list.Count; for (int i = 0; i < count; i++) { tmp += toJson(Info.list[i]); } tmp = removeComma(tmp); tmp += Info.type == ValueType.Array ? "]," : "},"; } } else { tmp += value(Info.type, Info.value); } return(tmp); }
public void ExtractAttribute(string s, string re, string attIdPrefix, JsonInfo jsonInfo, bool artKey = false) { jsonInfo.attText = jsonInfo.rm.MatchRegex(s, re); jsonInfo.atts = jsonInfo.attText.Split(':'); if (jsonInfo.atts.Length > 1) { jsonInfo.att = jsonInfo.atts[1].Replace(',', ' '); jsonInfo.att = jsonInfo.att.Replace('"', ' '); jsonInfo.att = jsonInfo.att.Replace('\\', ' '); jsonInfo.att = jsonInfo.att.Trim(); if (artKey == true) { jsonInfo.akAtt = string.Copy(jsonInfo.att); jsonInfo.ArtKey3Dig1 = jsonInfo.att.Split('.'); if (jsonInfo.intAns == 1 || jsonInfo.intAns == 2) { jsonInfo.currArtKey3Dig = int.Parse(jsonInfo.ArtKey3Dig1[0]); if (jsonInfo.currArtKey3Dig != jsonInfo.prevArtKey3Dig && jsonInfo.prevArtKey3Dig != 000) { jsonInfo.newCatalog = true; } } } } else { jsonInfo.att = string.Copy(jsonInfo.attText); } jsonInfo.idCurr += attIdPrefix; jsonInfo.idCurr += jsonInfo.att; }
public void setValues(JsonInfo jsonMediaObject) { this.title = jsonMediaObject.title; this.urlThumbnail = jsonMediaObject.urlThumbnail; this.urlContent = jsonMediaObject.urlContent; this.contentType = jsonMediaObject.contentType; this.m_SceneToLoad = this.contentType; }
private void CreateAxy(JsonInfo json) { axyJSON _axy = json.axy[0]; var inst = axyFactory.GetNewInstance(); var transform1 = inst.transform; transform1.position = new Vector2(_axy.position[0], _axy.position[1]); }
private void CreateFinishLine(JsonInfo json) { finishLineJSON _finishLine = json.finishLine[0]; var inst = finishLineFactory.GetNewInstance(); var transform1 = inst.transform; transform1.position = new Vector2(_finishLine.position[0], _finishLine.position[1]); }
private static JsonInfo JValue(List <Token> tokens, int index, ref JsonParseError jsonError) { JsonInfo info = new JsonInfo(); info.type = GetType(tokens, index); info.key = GetKey(tokens, index, ref jsonError); info.value = tokens[index].getValue(); return(info); }
void Start() { JsonInfo jsoNinfo = JsonUtility.FromJson <JsonInfo>(jsonFile.text); CreateWalls(jsoNinfo); CreateEnemies(jsoNinfo, "BG"); CreateEnemies(jsoNinfo, "DS"); CreateEnemies(jsoNinfo, "Rat"); CreateAxy(jsoNinfo); CreateEnemies(jsoNinfo, "HZ"); CreateFinishLine(jsoNinfo); }
private void CreateWalls(JsonInfo json) { wallJSON wall = json.walls[0]; for (int i = 0; i < wall.positions.Count - 1; i += 2) { var inst = wallFactory.GetNewInstance(); var transform1 = inst.transform; transform1.position = new Vector2(wall.positions[i], wall.positions[i + 1]); transform1.localScale = new Vector2(wall.scales[i], wall.scales[i + 1]); } }
public static JsonInfo ReadJson() { //文件流 读取 StreamReader sr = new StreamReader(filePath); //读取的Json字符串 string readContent = sr.ReadToEnd(); //反序列化操作 JsonInfo json = JsonMapper.ToObject <JsonInfo>(readContent); return(json); }
/* * Complete the function below. */ static void openAndClosePrices(string firstDate, string lastDate, string weekDay) { DateTime dt1 = DateTime.Parse(firstDate); DateTime dt2 = DateTime.Parse(lastDate); List <DateTime> weekdayDay = new List <DateTime>(); for (DateTime dt = dt1; dt <= dt2;) { if (dt.DayOfWeek.ToString() == weekDay) { weekdayDay.Add(dt); } dt = dt.AddDays(1); } string url; using (WebClient webClient = new WebClient()) { string jsonData = string.Empty; string searchValue = weekdayDay[0].Day + "-" + weekdayDay[0].ToString("MMMM") + "-" + weekdayDay[0].Year; url = "https://jsonmock.hackerrank.com/api/stocks/?key=" + searchValue; try { jsonData = webClient.DownloadString(url); } catch (Exception) { } if (!string.IsNullOrEmpty(jsonData)) { JsonInfo jsonInfo = JsonConvert.DeserializeObject <JsonInfo>(jsonData); int counter = 0; for (int a = 0; a < jsonInfo.data.Length; a++) { for (int b = 0; b < weekdayDay.Count; b++) { if (DateTime.Parse(jsonInfo.data[a].date.ToString()) == weekdayDay[b]) { Console.WriteLine(jsonInfo.data[a].date + " " + jsonInfo.data[a].open + " " + jsonInfo.data[a].close); counter++; } } if (DateTime.Parse(jsonInfo.data[a].date) > dt2) { break; } } } } }
/// <summary> /// tokens[index].getType() == TokenType.START_OBJ /// </summary> /// <param name="tokens"></param> /// <param name="index"></param> /// <returns></returns> private static JsonInfo JObject(List <Token> tokens, int index, ref JsonParseError jsonError) { JsonInfo info = GetJsonInfo(tokens, index, ref jsonError); if (info == null) { return(null); } info.type = ValueType.Object; info.list = GetAttribute(tokens, index, ref jsonError); return(info); }
void Awake() { if (instance != null) { Destroy(gameObject); } else { string jsonText = Resources.Load <TextAsset>("InfoText").text; allInfo = JsonUtility.FromJson <JsonInfo>(jsonText); instance = this; DontDestroyOnLoad(gameObject); } }
public static string TestParser(string jsonString) { //JsonMapper.ToJson(jsonString); StringBuilder builder = new StringBuilder(); JsonDemo jsonObj = JsonMapper.ToObject <JsonDemo>(jsonString); for (int i = 0; i < jsonObj.GetSites().Count; i++) { JsonInfo info = jsonObj.GetSites()[i]; builder.Append("name:" + info.Name + "; url:" + info.Url).Append("\n"); } return(builder.ToString()); }
private static JsonInfo GetJsonInfo(List <Token> tokens, int index, ref JsonParseError jsonError) { JsonInfo info = new JsonInfo(); info.key = GetKey(tokens, index, ref jsonError); int end = GetValueEndIndex(tokens, index); if (end == -1) { return(null); } info.value = GetValue(tokens, index, end); return(info); }
private List <DriverInfomation> getAllDriver() { var request = WebRequest.Create("https://fast-hollows-58498.herokuapp.com/driver/coordInfo"); request.ContentType = "application/json; charset=utf-8"; string text; var response = (HttpWebResponse)request.GetResponse(); using (var sr = new StreamReader(response.GetResponseStream())) { text = sr.ReadToEnd(); JavaScriptSerializer js = new JavaScriptSerializer(); JsonInfo jsoninfo = new JsonInfo(text); if (jsoninfo.status != 200) { @ViewBag.Error = "Error " + jsoninfo.status; return(null); } if (jsoninfo.payload.Length == 0) { @ViewBag.Error = "No driver near your location."; return(null); } // Cắt chuỗi để lấy thông tin JSon Payload string JsonPayload = text.Remove(0, 24); JsonPayload = JsonPayload.Remove(JsonPayload.Length - 1); dynamic dynObj = JsonConvert.DeserializeObject(JsonPayload); List <DriverInfomation> listDriver = new List <DriverInfomation>(); foreach (var item in dynObj) { string id = item.driverID; string fullname = item.driverFullname; string phone = item.driverPhone; float lng = item.longitude; float lat = item.latitude; DriverInfomation driver = new DriverInfomation(id, fullname, phone, lng, lat); listDriver.Add(driver); } return(listDriver); } }
static void Main(string[] args) { if (args.Length > 0) { } else { return; } // 参数Json格式 string parameter = "{\"type\":\"android\", \"bundle_id\":\"" + args[0] + "\", \"api_token\":\"" + args[1] + "\"}"; string str_Json = Post("http://api.fir.im/apps", parameter); //Json转对象 JsonInfo jsonInfo = JsonConvert.DeserializeObject <JsonInfo>(str_Json); Console.WriteLine(args[2]); string path = args[2]; string name = args[3]; string version = args[4]; string build = args[5]; // 异步上传文件 curl(jsonInfo.cert.binary.key, jsonInfo.cert.binary.token, name, version, build, path); // 推送钉钉 string url = "https://oapi.dingtalk.com/robot/send?access_token="; string token = args[6]; string test = args[7]; string messageUrl = args[8]; PostDindDind(url, token, test, messageUrl); Console.WriteLine("请等上传完成后在按回车"); Console.ReadLine(); }
void Update() { string json = nuitrack.Nuitrack.GetInstancesJson(); faceInfo = JsonUtility.FromJson <JsonInfo>(json.Replace("\"\"", "[]")); faces = faceInfo.Instances; for (int i = 0; i < faceControllers.Count; i++) { if (faces != null && i < faces.Length) { int id = 0; Face currentFace = faces[i].face; // Pass the face to FaceController faceControllers[i].SetFace(currentFace); faceControllers[i].gameObject.SetActive(true); // IDs of faces and skeletons are the same id = faces[i].id; nuitrack.Skeleton skeleton = null; if (NuitrackManager.SkeletonData != null) { skeleton = NuitrackManager.SkeletonData.GetSkeletonByID(id); } if (skeleton != null) { nuitrack.Joint head = skeleton.GetJoint(nuitrack.JointType.Head); faceControllers[i].transform.position = new Vector2(head.Proj.X * Screen.width, Screen.height - head.Proj.Y * Screen.height); //stretch the face to fit the rectangle if (currentFace.rectangle != null) { faceControllers[i].transform.localScale = new Vector2(currentFace.rectangle.width * Screen.width, currentFace.rectangle.height * Screen.height); } } } else { faceControllers[i].gameObject.SetActive(false); } } }
private JsonInfo removeKey(string key) { JsonInfo info = null; if (!isNull()) { int count = jsonInfo.list.Count; for (int i = 0; i < count; i++) { if (jsonInfo.list[i].key == key) { info = jsonInfo.list[i]; jsonInfo.list.Remove(jsonInfo.list[i]); break; } } } return(info); }
/// <summary> /// tokens[index].getType() == TokenType.START_ARRAY /// </summary> /// <param name="tokens"></param> /// <param name="index"></param> /// <returns></returns> private static JsonInfo JArray(List <Token> tokens, int index, ref JsonParseError jsonError) { JsonInfo info = GetJsonInfo(tokens, index, ref jsonError); if (info == null) { return(null); } info.type = ValueType.Array; info.list = new List <JsonInfo>(); int end = GetValueEndIndex(tokens, index); for (int i = index + 1; i < end; i++) { switch (tokens[i].getType()) { case TokenType.START_OBJ: info.list.Add(JObject(tokens, i, ref jsonError)); i = GetValueEndIndex(tokens, i); break; case TokenType.START_ARRAY: info.list.Add(JArray(tokens, i, ref jsonError)); i = GetValueEndIndex(tokens, i); break; case TokenType.BOOLEAN: case TokenType.NUMBER: case TokenType.NULL: case TokenType.STRING: JsonInfo ji = new JsonInfo { value = tokens[i].getValue(), type = GetType(tokens, i) }; info.list.Add(ji); break; } } return(info); }
private void saveGradientToolStripMenuItem_Click(object sender, EventArgs e) { SaveFileDialog SaveSetting = new SaveFileDialog(); SaveSetting.Filter = "json files(*.json)| *.json"; SaveSetting.RestoreDirectory = true; SaveSetting.FileName = @"\settings\gradient.json"; if (SaveSetting.ShowDialog() == DialogResult.OK) { JsonInfo jsoninfo = new JsonInfo(Gradients.Colors, Gradients.Positions, Gradients.Angles, Gradients.Setting); String json = JsonConvert.SerializeObject(jsoninfo, Formatting.Indented); //Console.WriteLine(json); using (StreamWriter file = File.CreateText(SaveSetting.FileName)) { file.Write(json); file.Close(); } } }
public override int GetHashCode() { int hash = 1; if (Type.Length != 0) { hash ^= Type.GetHashCode(); } if (JsonInfo.Length != 0) { hash ^= JsonInfo.GetHashCode(); } if (SendIP.Length != 0) { hash ^= SendIP.GetHashCode(); } if (SendName.Length != 0) { hash ^= SendName.GetHashCode(); } return(hash); }
private void loadGradientToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog opentxt = new OpenFileDialog(); opentxt.Filter = "json files(*.json)| *.json"; opentxt.RestoreDirectory = true; if (opentxt.ShowDialog() == DialogResult.OK) { JsonInfo jsoninfo = new JsonInfo(); jsoninfo = JsonConvert.DeserializeObject <JsonInfo>(File.ReadAllText(opentxt.FileName)); Console.WriteLine("at lest you got here"); Gradients.Colors = jsoninfo.Colors; Gradients.Positions = jsoninfo.Positions; Gradients.Angles = jsoninfo.Angles; Gradients.Setting = jsoninfo.Setting; chkColor.Checked = true; } }
void Update() { faceInfo = faceAnimManager.faceInfo; if (faceInfo == null || faceInfo.Instances.Length == 0 || faceInfo.Instances[0].face == null || faceInfo.Instances[0].face.landmark == null) { return; } Face face = faceInfo.Instances[0].face; for (int i = 0; i < landmarkCount; i++) { Vector2 point = face.landmark[i]; points[i].position = new Vector2(point.x * Screen.width, Screen.height - point.y * Screen.height); } points[32].position = new Vector2(face.left_eye.x * Screen.width, Screen.height - face.left_eye.y * Screen.height); points[32].GetComponent <UnityEngine.UI.Image>().color = Color.red; points[31].position = new Vector2(face.right_eye.x * Screen.width, Screen.height - face.right_eye.y * Screen.height); points[31].GetComponent <UnityEngine.UI.Image>().color = Color.green; }
private void CreateEnemies(JsonInfo json, String ene) { if (ene == "BG") { blindGazersJSON enemy = json.blindGazers[0]; for (int i = 0; i < enemy.positions.Count - 1; i += 2) { var inst = blindGazerFactory.GetNewInstance(); inst.transform.position = new Vector2(enemy.positions[i], enemy.positions[i + 1]); } } else if (ene == "DS") { drunkSkeletonJSON enemy = json.drunkSkeletons[0]; for (int i = 0; i < enemy.positions.Count - 1; i += 2) { var inst = drunkSkeletonFactory.GetNewInstance(); inst.transform.position = new Vector2(enemy.positions[i], enemy.positions[i + 1]); } } else if (ene == "Rat") { ratJSON rat = json.rats[0]; for (int i = 0; i < rat.positions.Count - 1; i += 2) { var inst = ratFactory.GetNewInstance(); inst.transform.position = new Vector2(rat.positions[i], rat.positions[i + 1]); } } else if (ene == "HZ") { hungryZombieJSON zombies = json.hungryZombies[0]; for (int i = 0; i < zombies.positions.Count - 1; i += 2) { var inst = hungryZombieFactory.GetNewInstance(); inst.transform.position = new Vector2(zombies.positions[i], zombies.positions[i + 1]); } } }
public void setJsonInfo(JsonInfo jsonInfo) { this.jsonInfo = jsonInfo; }
void Update() { json = nuitrack.Nuitrack.GetInstancesJson(); objectInfo = JsonUtility.FromJson <JsonInfo>(json.Replace("\"\"", "[]")); objects = objectInfo.Instances; cigaretteDetected = false; for (int i = 0; i < frames.Count; i++) { if (objects != null && i < objects.Length && objects[i].@class != "human") { frames[i].gameObject.SetActive(true); print(objects[i].@class + objects[i].bbox.top); float frameWidth = objects[i].bbox.width * Screen.width; float frameHeight = objects[i].bbox.height * Screen.height; float posx = objects[i].bbox.left * Screen.width; float posy = objects[i].bbox.top * Screen.height; frames[i].anchoredPosition = new Vector2(posx - Screen.width / 2 + frameWidth / 2, -posy + Screen.height / 2 - frameHeight / 2); frames[i].sizeDelta = new Vector2(frameWidth, frameHeight); frames[i].GetComponentInChildren <Text>().text = objects[i].@class; if (objects[i].@class == "cigarette") { cigaretteDetected = true; } } else { frames[i].gameObject.SetActive(false); } } if (cigaretteDetected) { detectTime += Time.deltaTime; } else { detectTime = 0; } if (detectTime >= detectTimeTarget) { if (!warningAS.isPlaying) { warningAS.Play(); } warningScreen.SetActive(true); } else { warningAS.Stop(); warningScreen.SetActive(false); } }
public JsonValue(JsonInfo jsonInfo) { this.jsonInfo = jsonInfo; }
private async void SetupGrid_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { if (setupGrid.Visibility == Visibility) { if (kind != "minecraft") { model.Content = "安装" + kind; } else { Second.Visibility = Visibility.Collapsed; } TaskFactory taskFactory = new TaskFactory(); string filename = string.Format(Settings.GamePath + "\\versions\\{0}\\{1}.json", version, version); string replaceurl = ""; if (Settings.DownloadSource == DownloadSource.BMCPAPI) { replaceurl = "https://bmclapi2.bangbang93.com/"; } else if (Settings.DownloadSource == DownloadSource.Mcbbs) { replaceurl = "https://download.mcbbs.net/"; } await taskFactory.StartNew(() => { if (!Directory.Exists(string.Format(Settings.GamePath + "\\versions\\{0}\\", version))) { Directory.CreateDirectory(string.Format(Settings.GamePath + "\\versions\\{0}\\", version)); } if (!File.Exists(filename)) { ProgressBar progressBar = null; Label label = null; Grid grid = null; this.Dispatcher.Invoke(new Action(() => { progressBar = new ProgressBar(); progressBar.IsIndeterminate = true; progressBar.Height = 4; progressBar.VerticalAlignment = VerticalAlignment.Bottom; label = new Label(); label.Margin = new Thickness(0, 0, 0, 4); label.FontFamily = new FontFamily("宋体"); label.Content = "连接中..."; grid = new Grid(); grid.Margin = new Thickness(0, 0, 0, 2); grid.Children.Add(progressBar); grid.Children.Add(label); StackPanel.Children.Add(grid); })); DownloadFile(SomethingUseful.JsonUrl(version, Settings.DownloadSource), filename, progressBar, label, grid, System.IO.Path.GetFileName(filename)); } }); JsonInfo jsonInfo = new JsonInfo(filename); Launcher.JsonInfo = jsonInfo; LaunchInfo launchInfo = new LaunchInfo(); launchInfo.Game.Selected_Version = version; launchInfo.Game.ComplementaryResources = true; launchInfo.Game.GamePath = Settings.GamePath; Launcher.LaunchInfo = launchInfo; await taskFactory.StartNew(() => { string assetsFile = String.Format(Settings.GamePath + "\\assets\\indexes\\{0}.json", jsonInfo.Assets); string assetsDir = String.Format(Settings.GamePath + "\\assets\\indexes\\"); if (!Directory.Exists(assetsDir)) { Directory.CreateDirectory(assetsDir); } ProgressBar progressBar = null; Label label = null; Grid grid = null; string url = jsonInfo.AssetIndex["url"].ToString(); if (Settings.DownloadSource != DownloadSource.Mojang) { url = url.Replace("https://launchermeta.mojang.com/", replaceurl); } bool need = false; if (!File.Exists(assetsFile)) { need = true; } else if (new FileInfo(assetsFile).Length != (int)jsonInfo.AssetIndex["size"]) { need = true; } if (need) { this.Dispatcher.Invoke(new Action(() => { progressBar = new ProgressBar(); progressBar.IsIndeterminate = true; progressBar.Height = 4; progressBar.VerticalAlignment = VerticalAlignment.Bottom; label = new Label(); label.Margin = new Thickness(0, 0, 0, 4); label.FontFamily = new FontFamily("宋体"); label.Content = "连接中..."; grid = new Grid(); grid.Margin = new Thickness(0, 0, 0, 2); grid.Children.Add(progressBar); grid.Children.Add(label); StackPanel.Children.Add(grid); })); DownloadFile(url, assetsFile, progressBar, label, grid, System.IO.Path.GetFileName(assetsFile)); } }); List <DownloadFile> downloadFiles = new List <DownloadFile>(); await taskFactory.StartNew(() => { downloadFiles = new LaunchFileVerifier().Verifier(Settings.DownloadSource, Libraries.Get(filename)); }); List <Task> tasks = new List <Task>(); foreach (DownloadFile downloadFile in downloadFiles) { tasks.Add(taskFactory.StartNew(() => { ProgressBar progressBar = null; Label label = null; Grid grid = null; this.Dispatcher.Invoke(new Action(() => { progressBar = new ProgressBar(); progressBar.IsIndeterminate = true; progressBar.Height = 4; progressBar.VerticalAlignment = VerticalAlignment.Bottom; label = new Label(); label.Margin = new Thickness(0, 0, 0, 4); label.FontFamily = new FontFamily("宋体"); label.Content = "连接中..."; grid = new Grid(); grid.Margin = new Thickness(0, 0, 0, 2); grid.Children.Add(progressBar); grid.Children.Add(label); StackPanel.Children.Add(grid); })); DownloadFile(downloadFile.Url, downloadFile.Path, progressBar, label, grid, downloadFile.Name); })); } await Task.WhenAll(tasks.ToArray()); this.Dispatcher.Invoke(new Action(() => { StackPanel.Children.Remove(check); icon1.Kind = MaterialDesignThemes.Wpf.PackIconKind.Check; icon2.Kind = MaterialDesignThemes.Wpf.PackIconKind.ArrowRight; })); if (kind != "minecraft") { string url = replaceurl; if (kind == "forge") { url += "forge/download/" + (string)downloadinfo["info"]["build"]; } else if (kind == "optifine") { url += "optifine/" + version + "/" + (string)downloadinfo["info"]["type"] + "/" + (string)downloadinfo["info"]["patch"]; } else if (kind == "liteloader") { url += "/maven/com/mumfrey/liteloader/${version}/liteloader-${version}.jar".Replace("${version}", (string)downloadinfo["info"]["version"]); } await taskFactory.StartNew(() => { Grid grid = null; ProgressBar progressBar = null; Label label = null; this.Dispatcher.Invoke(new Action(() => { progressBar = new ProgressBar(); progressBar.IsIndeterminate = true; progressBar.Height = 4; progressBar.VerticalAlignment = VerticalAlignment.Bottom; label = new Label(); label.Margin = new Thickness(0, 0, 0, 4); label.FontFamily = new FontFamily("宋体"); label.Content = "连接中..."; grid = new Grid(); grid.Margin = new Thickness(0, 0, 0, 2); grid.Children.Add(progressBar); grid.Children.Add(label); StackPanel1.Children.Add(grid); })); DownloadFile(url, Settings.GamePath + "\\" + (string)downloadinfo["FileName"], progressBar, label, grid, (string)downloadinfo["FileName"]); this.Dispatcher.Invoke(new Action(() => { StackPanel1.Children.Remove(grid); })); }); Grid g = null; ProgressBar p = null; Label l = null; this.Dispatcher.Invoke(new Action(() => { p = new ProgressBar(); p.IsIndeterminate = true; p.Height = 4; p.VerticalAlignment = VerticalAlignment.Bottom; p.IsIndeterminate = true; l = new Label(); l.Margin = new Thickness(0, 0, 0, 4); l.FontFamily = new FontFamily("宋体"); l.Content = "运行" + kind; g = new Grid(); g.Margin = new Thickness(0, 0, 0, 2); g.Children.Add(p); g.Children.Add(l); StackPanel1.Children.Add(g); })); Process process = new Process(); process.StartInfo.FileName = Settings.JavaPath; process.StartInfo.Arguments = "-jar " + Settings.GamePath + "\\" + (string)downloadinfo["FileName"]; await taskFactory.StartNew(() => { process.Start(); process.WaitForExit(); this.Dispatcher.BeginInvoke(new Action(() => { StackPanel1.Children.Remove(g); icon2.Kind = icon3.Kind = MaterialDesignThemes.Wpf.PackIconKind.Check; SetupDone.Visibility = Visibility.Visible; })); }); } else { await this.Dispatcher.BeginInvoke(new Action(() => { icon2.Kind = icon3.Kind = MaterialDesignThemes.Wpf.PackIconKind.Check; SetupDone.Visibility = Visibility.Visible; })); } Launcher.JsonInfo = null; Launcher.LaunchInfo = null; } }
private JsonResult verifyDeliver(Dictionary <string, string> parms) { receipt = new JsonResult(); receipt.ResultCode = 0; try { while (true) { parms.TryGetValue("DATA", out _data); JsonInfo jsoninfo = MathUtils.ParseJson <JsonInfo>(_data); if (jsoninfo == null) { receipt.ResultString = "数据解析错误"; break; } // MD5 string signParameter = md5key + jsoninfo.UserId + jsoninfo.ServerID + jsoninfo.PayId; string sign = CryptoHelper.MD5_Encrypt(signParameter, Encoding.UTF8).ToLower(); if (sign.CompareTo(jsoninfo.Sign) != 0) { receipt.ResultString = "MD5验证失败"; break; } UserBasisCache user = UserHelper.FindUserBasis(jsoninfo.UserId); if (user == null || user.ServerID != jsoninfo.ServerID) { receipt.ResultString = "没有找到该玩家"; break; } UserPayCache userpay = UserHelper.FindUserPay(user.UserID); if (userpay == null) { receipt.ResultString = "没有找到该玩家充值信息表"; break; } var paycfg = new ShareCacheStruct <Config_Pay>().FindKey(jsoninfo.PayId); if (paycfg == null) { receipt.ResultString = "PayId 错误"; break; } if (!UserHelper.OnWebPay(user.UserID, jsoninfo.PayId)) { receipt.ResultString = "发货失败"; return(receipt); } receipt.ResultCode = 1; receipt.ResultString = "SUCCEED"; break; } } catch (Exception e) { receipt.ResultString = "Url参数格式错误"; TraceLog.WriteError(string.Format("{0} {1}", receipt.ResultString, e)); return(receipt); } return(receipt); }
private void LoadData() { json = Json.ReadJson(); }