private void Test() { System.Collections.Generic.List<BetAnalyse> listBA = new List<BetAnalyse>(); try { using (var webClient = new System.Net.WebClient()) { var json = webClient.DownloadString("https://spreadsheets.google.com/feeds/list/0ArjfL6TJnxG3dHZNNlNZbGU0a0JMT21oWno2WXR4bEE/od5/public/values?alt=json-in-script"); string s = json.ToString().Replace("gdata.io.handleScriptLoaded(", "").Replace(");", ""); Newtonsoft.Json.JavaScriptObject jSObj = (Newtonsoft.Json.JavaScriptObject)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(s); if (jSObj != null) { Newtonsoft.Json.JavaScriptObject jSObjFeed = (Newtonsoft.Json.JavaScriptObject)jSObj["feed"]; if (jSObjFeed != null) { Newtonsoft.Json.JavaScriptArray jSArrEntry = (Newtonsoft.Json.JavaScriptArray)jSObjFeed["entry"]; if (jSArrEntry != null) { using (System.Collections.Generic.List<object>.Enumerator enumerator = jSArrEntry.GetEnumerator()) { while (enumerator.MoveNext()) { Newtonsoft.Json.JavaScriptObject objCurrent = (Newtonsoft.Json.JavaScriptObject)enumerator.Current; BetAnalyse betAnalyse = new BetAnalyse(); Newtonsoft.Json.JavaScriptObject jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$odd"]; betAnalyse.OddType = jsObj2["$t"].ToString(); jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$count"]; betAnalyse.Count = int.Parse(jsObj2["$t"].ToString()); jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$won"]; betAnalyse.Won = int.Parse(jsObj2["$t"].ToString()); jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$lose"]; betAnalyse.Lose = int.Parse(jsObj2["$t"].ToString()); jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$draw"]; betAnalyse.Draw = int.Parse(jsObj2["$t"].ToString()); jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$allow"]; if (jsObj2["$t"].ToString() == "1") betAnalyse.Allow = true; else betAnalyse.Allow = false; listBA.Add(betAnalyse); } } } } } } } catch (Exception ex) { //this.ShowErrorDialog("Error while initialize SBOBET Engine. \nDetails: " + ex.Message); } if (listBA.Count > 0) { var max = listBA.Max(obj => obj.Diff); var min = listBA.Min(obj => obj.Diff); foreach (BetAnalyse ba in listBA) { if (ba.Diff == max) ba.isGoodOddToBet = true; if (ba.Diff == min) ba.isGoodOddToBet = true; } Console.Write(max); } }
private void LoadAnalyse() { this.listBA.Clear(); try { using (var webClient = new System.Net.WebClient()) { var json = webClient.DownloadString(""); string s = json.ToString().Replace("gdata.io.handleScriptLoaded(", "").Replace(");", ""); Newtonsoft.Json.JavaScriptObject jSObj = (Newtonsoft.Json.JavaScriptObject)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(s); if (jSObj != null) { Newtonsoft.Json.JavaScriptObject jSObjFeed = (Newtonsoft.Json.JavaScriptObject)jSObj["feed"]; if (jSObjFeed != null) { Newtonsoft.Json.JavaScriptArray jSArrEntry = (Newtonsoft.Json.JavaScriptArray)jSObjFeed["entry"]; if (jSArrEntry != null) { using (System.Collections.Generic.List<object>.Enumerator enumerator = jSArrEntry.GetEnumerator()) { while (enumerator.MoveNext()) { Newtonsoft.Json.JavaScriptObject objCurrent = (Newtonsoft.Json.JavaScriptObject)enumerator.Current; BetAnalyse betAnalyse = new BetAnalyse(); Newtonsoft.Json.JavaScriptObject jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$odd"]; betAnalyse.OddType = jsObj2["$t"].ToString(); jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$count"]; betAnalyse.Count = int.Parse(jsObj2["$t"].ToString()); jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$won"]; betAnalyse.Won = int.Parse(jsObj2["$t"].ToString()); jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$lose"]; betAnalyse.Lose = int.Parse(jsObj2["$t"].ToString()); jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$draw"]; betAnalyse.Draw = int.Parse(jsObj2["$t"].ToString()); jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$allow"]; if (jsObj2["$t"].ToString() == "1") betAnalyse.Allow = true; else betAnalyse.Allow = false; listBA.Add(betAnalyse); } } } } } } } catch (Exception ex) { this.ShowErrorDialog("Error while loading strategy. \nDetails: " + ex.Message); } if (this.listBA.Count > 0) { var max = listBA.Max(obj => obj.Diff); var min = listBA.Min(obj => obj.Diff); string s = ""; foreach (BetAnalyse ba in listBA) { if (ba.Diff >= (int)txtAddValue.Value && (ba.WinPercent >= 0.68 || ba.WinPercent <= 0.30 )) { ba.isGoodOddToBet = true; s += ba.OddType + " with Under;\n"; } if (ba.Diff <= -(int)txtAddValue.Value && (ba.WinPercent >= 0.68 || ba.WinPercent <= 0.30)) { ba.isGoodOddToBet = true; s += ba.OddType + " with Over;\n"; } } this.ShowWarningDialog("Found odd:\n" + s); iBet.Utilities.WriteLog.Write("Load Odd Analyse: Rank " + this.txtAddValue.Value.ToString() + "\n" + s); } }