Skip to content

Commit

Permalink
Only check for updates after 14days;
Browse files Browse the repository at this point in the history
  • Loading branch information
sp0ok3r committed Dec 22, 2019
1 parent c8b9645 commit 5b5fae1
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 20 deletions.
52 changes: 33 additions & 19 deletions MercuryBOT/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,40 @@ private int LoadSteam()
[Obsolete]
private void Main_Shown(object sender, EventArgs e)
{
RafadexAutoUpdate600IQ();
var SettingsList = JsonConvert.DeserializeObject<MercurySettings>(File.ReadAllText(Program.SettingsJsonFile));

DateTime now = DateTime.Now;
if (SettingsList.LastTimeCheckedUpdate.Length==0)
{
SettingsList.LastTimeCheckedUpdate = now.ToString();
}

DateTime old = DateTime.Parse(SettingsList.LastTimeCheckedUpdate);
if (SettingsList.LastTimeCheckedUpdate.Length < 0 && (old - now).TotalDays < 14) //check for update 14 days later
{
SettingsList.LastTimeCheckedUpdate = now.ToString();
RafadexAutoUpdate600IQ();
}

File.WriteAllText(Program.SettingsJsonFile, JsonConvert.SerializeObject(SettingsList, Formatting.Indented));
M_NotifyIcon = this.Mercury_notifyIcon;

if (SettingsList.startupAcc != 0)
{
var list = JsonConvert.DeserializeObject<RootObject>(File.ReadAllText(Program.AccountsJsonFile));

foreach (var a in list.Accounts)
{
if (a.SteamID == SettingsList.startupAcc)
{
usernameJSON = a.username;
passwordJSON = a.password;
}
}
// Start Login
Thread doLogin = new Thread(() => AccountLogin.UserSettingsGather(usernameJSON, passwordJSON));
doLogin.Start();
}
}

[Obsolete]
Expand Down Expand Up @@ -272,24 +304,6 @@ private void RafadexAutoUpdate600IQ()
else
{
this.Enabled = true;
var SettingsList = JsonConvert.DeserializeObject<MercurySettings>(File.ReadAllText(Program.SettingsJsonFile));

if (SettingsList.startupAcc != 0)
{
var list = JsonConvert.DeserializeObject<RootObject>(File.ReadAllText(Program.AccountsJsonFile));

foreach (var a in list.Accounts)
{
if (a.SteamID == SettingsList.startupAcc)
{
usernameJSON = a.username;
passwordJSON = a.password;
}
}
// Start Login
Thread doLogin = new Thread(() => AccountLogin.UserSettingsGather(usernameJSON, passwordJSON));
doLogin.Start();
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion MercuryBOT/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static class Program
public static readonly Process[] CurrentProcesses = Process.GetProcesses();

public static readonly string BOTNAME = "MercuryBOT";
public static readonly string Version = "4.0.0beta6.3c";//4.0.0
public static readonly string Version = "4.0.0beta6.3d";//4.0.0

public static readonly string spkDomain = "http://sp0ok3r.tk/Mercury/";

Expand Down
1 change: 1 addition & 0 deletions MercuryBOT/User2Json/MercurySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ public partial class MercurySettings
public ulong startupAcc { get; set; }
public bool startMinimized { get; set; }
//public string notificationEffect { get; set; }
public string LastTimeCheckedUpdate { get; set; }
}
}

0 comments on commit 5b5fae1

Please sign in to comment.