Skip to content

Commit

Permalink
Merge pull request #379 from Micdu70/patch-1
Browse files Browse the repository at this point in the history
Bug fix
  • Loading branch information
qutrits authored Sep 23, 2024
2 parents d0410d7 + cad7b2e commit 9d9d13b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions Views/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 { }
Expand Down
6 changes: 3 additions & 3 deletions Views/Stats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 9d9d13b

Please sign in to comment.