private void UpdateResponse(IAsyncResult result) { try { HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result); Stream resStream = response.GetResponseStream(); string tempString; int count; StringBuilder sb = new StringBuilder(); byte[] buf = new byte[0x1000]; do { count = resStream.Read(buf, 0, buf.Length); if (count != 0) { tempString = Encoding.ASCII.GetString(buf, 0, count); sb.Append(tempString); } }while (count > 0); string dataVer = Regex.Match(sb.ToString(), @"FoVChangerVer\[([0-9\.]+)\]").Groups[1].Value; string dataSafe = Regex.Match(sb.ToString(), @"SafeToUse\[([A-Za-z]+)\]").Groups[1].Value; //MessageBox.Show(dataVer); if (!String.IsNullOrEmpty(dataSafe) && dataSafe.ToLower() == "vacdetected") { DialogResult vacResult = MessageBox.Show("It has been reported that this FoV Changer may cause Valve Anti-Cheat to trigger a ban. " + "For any information, please check MapModNews.com.\n\n" + "Click 'OK' to exit the program, or 'Cancel' to continue using it AT YOUR OWN RISK.", "Detection alert", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); if (vacResult == DialogResult.OK) { Application.Exit(); } } //MessageBox.Show(dataVer); if (!String.IsNullOrEmpty(dataVer) && VersionNum(dataVer) > VersionNum(c_toolVer)) { lblUpdateAvail.Text = "└ Update v" + dataVer + " available"; lblUpdateAvail.Enabled = true; lblUpdateAvail.Visible = true; if (updateChk) { MessageBox.Show("Update v" + dataVer + " for the FoV Changer is available at MapModNews.com", "Update available", MessageBoxButtons.OK, MessageBoxIcon.Information); } TimerBlink.Start(); } } catch { } requestSent = false; }
private void UpdateResponse(IAsyncResult result) { try { HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result); Stream resStream = response.GetResponseStream(); string tempString; int count; StringBuilder sb = new StringBuilder(); byte[] buf = new byte[0x2000]; do { count = resStream.Read(buf, 0, buf.Length); if (count != 0) { tempString = Encoding.ASCII.GetString(buf, 0, count); sb.Append(tempString); } }while (count > 0); string returnData = sb.ToString(); string dataVer = Regex.Match(returnData, @"FoVChangerVer\[([0-9\.]*?)\]").Groups[1].Value; string dataSafe = Regex.Match(returnData, @"SafeToUse\[([A-Za-z]*?)\]").Groups[1].Value; string dataInfo = Regex.Unescape(HttpUtility.HtmlDecode(Regex.Match(returnData, @"UpdateInfo\[(.*?)\]").Groups[1].Value)); string dataDownloadLink = Regex.Match(returnData, @"DownloadLink\[(.*?)\]").Groups[1].Value; string dataAnalytics = Regex.Match(returnData, @"GoogleAnalytics\[([A-Za-z\-0-9]*?)\]").Groups[1].Value; string dataIPService = Regex.Match(returnData, @"IPService\[(.*?)\]").Groups[1].Value; //MessageBox.Show(dataSafe); if (!String.IsNullOrEmpty(dataSafe) && dataSafe.ToLower() == "vacdetected") { this.Invoke(new Action(() => { DialogResult vacResult = MessageBox.Show(this, "It has been reported that this FoV Changer may cause anti-cheat software to trigger a ban. " + "For any information, please check github.com/AgentRev/CoD-FoV-Changers\n\n" + "Click 'OK' to exit the program, or 'Cancel' to continue using it AT YOUR OWN RISK.", "Detection alert", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); if (vacResult == DialogResult.OK) { Application.Exit(); } })); } //MessageBox.Show(dataVer); if (!String.IsNullOrEmpty(dataVer) && VersionNum(dataVer) > VersionNum(c_toolVer)) { this.Invoke(new Action(() => { updateAvailable = true; if (chkUpdate.Checked && updateNotify) { MessageBox.Show(this, "Update v" + dataVer + " is available at MapModNews.com\nClicking the \"Help\" button below will take you to the download page." + (!String.IsNullOrEmpty(dataInfo) ? "\n\nInfos:\n" + dataInfo : ""), "Update available", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, 0, (!String.IsNullOrEmpty(dataDownloadLink) ? dataDownloadLink : "http://ghostsfov.ftp.sh/")); lblUpdateAvail.Text = "Update v" + dataVer + " available"; lblUpdateAvail.Enabled = true; lblUpdateAvail.Visible = true; TimerBlink.Start(); } else { requestSent = false; } })); } if (!String.IsNullOrEmpty(dataAnalytics)) { GAnalytics.trackingID = dataAnalytics; } if (!String.IsNullOrEmpty(dataIPService)) { GAnalytics.ipService = dataIPService; } } catch {} try { GAnalytics.TriggerAnalytics((string)gameMode.GetValue("c_settingsDirName") + " v" + c_toolVer, firstTime); } catch {} }
private void UpdateResponse(IAsyncResult result) { try { HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result); Stream resStream = response.GetResponseStream(); string tempString; int count; StringBuilder sb = new StringBuilder(); byte[] buf = new byte[0x2000]; do { count = resStream.Read(buf, 0, buf.Length); if (count != 0) { tempString = Encoding.ASCII.GetString(buf, 0, count); sb.Append(tempString); } }while (count > 0); string dataVer = Regex.Match(sb.ToString(), @"FoVChangerVer\[([0-9\.]*?)\]").Groups[1].Value; string dataSafe = Regex.Match(sb.ToString(), @"SafeToUse\[([A-Za-z]*?)\]").Groups[1].Value; string dataInfo = Regex.Unescape(HttpUtility.HtmlDecode(Regex.Match(sb.ToString(), @"UpdateInfo\[(.*?)\]").Groups[1].Value)); //MessageBox.Show(dataVer); if (!String.IsNullOrEmpty(dataSafe) && dataSafe.ToLower() == "vacdetected") { this.Invoke(new Action(() => { DialogResult vacResult = MessageBox.Show(this, "It has been reported that this FoV Changer may cause Valve Anti-Cheat to trigger a ban. " + "For any information, please check MapModNews.com.\n\n" + "Click 'OK' to exit the program, or 'Cancel' to continue using it AT YOUR OWN RISK.", "Detection alert", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); if (vacResult == DialogResult.OK) { Application.Exit(); } })); } //MessageBox.Show(dataVer); if (!String.IsNullOrEmpty(dataVer) && VersionNum(dataVer) > VersionNum(c_toolVer)) { this.Invoke(new Action(() => { if (updateChk) { MessageBox.Show(this, "Update v" + dataVer + " for the FoV Changer is available at MapModNews.com, or can be downloaded directly \nby clicking the \"Help\" button below." + (!String.IsNullOrEmpty(dataInfo) ? "\n\nAdditional infos:\n" + dataInfo : ""), "Update available", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, 0, "http://mw3fov.ftp.sh/"); } lblUpdateAvail.Text = " - Update v" + dataVer + " available"; lblUpdateAvail.Enabled = true; lblUpdateAvail.Visible = true; TimerBlink.Start(); })); } } catch {} requestSent = false; }