From cad7b2eca135de0d3fd9623e28f79fc1ac660bf6 Mon Sep 17 00:00:00 2001 From: Micdu70 Date: Sun, 22 Sep 2024 19:01:07 +0200 Subject: [PATCH] Bug fix --- Views/Settings.cs | 12 ++++++------ Views/Stats.cs | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Views/Settings.cs b/Views/Settings.cs index d57d33d8..48206923 100644 --- a/Views/Settings.cs +++ b/Views/Settings.cs @@ -64,9 +64,9 @@ private void Settings_Load(object sender, EventArgs e) { this.IpGeolocationService = this.CurrentSettings.IpGeolocationService; this.cboIpGeolocationService.SelectedIndex = this.IpGeolocationService; - if (File.Exists(this.StatsForm.IPinfoTokenFilePath)) { + if (File.Exists(Stats.IPinfoTokenFilePath)) { try { - StreamReader sr = new StreamReader(this.StatsForm.IPinfoTokenFilePath); + StreamReader sr = new StreamReader(Stats.IPinfoTokenFilePath); this.IPinfoToken = sr.ReadLine(); sr.Close(); } catch { @@ -469,16 +469,16 @@ private void btnSave_Click(object sender, EventArgs e) { this.CurrentSettings.IpGeolocationService = this.IpGeolocationService; if (string.IsNullOrEmpty(this.txtIPinfoToken.Text)) { - if (File.Exists(this.StatsForm.IPinfoTokenFilePath)) { + if (File.Exists(Stats.IPinfoTokenFilePath)) { try { - File.SetAttributes(this.StatsForm.IPinfoTokenFilePath, FileAttributes.Normal); - File.Delete(this.StatsForm.IPinfoTokenFilePath); + File.SetAttributes(Stats.IPinfoTokenFilePath, FileAttributes.Normal); + File.Delete(Stats.IPinfoTokenFilePath); } catch { } } Stats.IPinfoToken = string.Empty; } else if (!this.IPinfoToken.Equals(this.txtIPinfoToken.Text)) { try { - StreamWriter sw = new StreamWriter(this.StatsForm.IPinfoTokenFilePath); + StreamWriter sw = new StreamWriter(Stats.IPinfoTokenFilePath); sw.WriteLine(this.txtIPinfoToken.Text); sw.Close(); } catch { } diff --git a/Views/Stats.cs b/Views/Stats.cs index 36d8f753..f4d48655 100644 --- a/Views/Stats.cs +++ b/Views/Stats.cs @@ -152,7 +152,7 @@ private static bool IsAlreadyRunning() { public static int IpGeolocationService; public static string IPinfoToken; - public readonly string IPinfoTokenFilePath = "IPinfo.io.txt"; + public static readonly string IPinfoTokenFilePath = "IPinfo.io.txt"; readonly DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle(); readonly DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle(); @@ -553,9 +553,9 @@ private Stats() { SucceededTestProxy = this.CurrentSettings.SucceededTestProxy; IpGeolocationService = this.CurrentSettings.IpGeolocationService; - if (File.Exists(this.IPinfoTokenFilePath)) { + if (File.Exists(IPinfoTokenFilePath)) { try { - StreamReader sr = new StreamReader(this.IPinfoTokenFilePath); + StreamReader sr = new StreamReader(IPinfoTokenFilePath); IPinfoToken = sr.ReadLine(); sr.Close(); } catch {