Skip to content

Commit

Permalink
Fix: always update LastUpdate date
Browse files Browse the repository at this point in the history
  • Loading branch information
xupefei committed Jan 15, 2017
1 parent 974af7a commit 0fdb507
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 5 additions & 4 deletions LEUpdater/ApplicationUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ internal static void CheckApplicationUpdate(string version, NotifyIcon notifyIco
private static void ProcessUpdate(XmlDocument xmlContent, NotifyIcon notifyIcon)
{
var newVer = xmlContent.SelectSingleNode(@"/VersionInfo/Version/text()").Value;

if (CompareVersion(GlobalHelper.GetLEVersion(), newVer))
var crtVer = GlobalHelper.GetLEVersion();

GlobalHelper.SetLastUpdate(int.Parse(DateTime.Now.ToString("yyyyMMdd")));

if (CompareVersion(crtVer, newVer))
{
try
{
GlobalHelper.SetLastUpdate(int.Parse(DateTime.Now.ToString("yyyyMMdd")));

var version = xmlContent.SelectSingleNode(@"/VersionInfo/Version/text()").Value;
var date = xmlContent.SelectSingleNode(@"/VersionInfo/Date/text()").Value;
url = xmlContent.SelectSingleNode(@"/VersionInfo/Url/text()").Value;
Expand Down
7 changes: 3 additions & 4 deletions LEUpdater/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ namespace LEUpdater
internal static class Program
{
private static readonly NotifyIcon _notifyIcon = new NotifyIcon {Icon = Resources.icon};
private static bool byForce;
private static bool auto;

private static void Main(string[] args)
{
if (args.Length == 0)
byForce = true;
auto = args.Length != 0;

// Check new version every week.
if (!byForce && int.Parse(DateTime.Now.ToString("yyyyMMdd")) - GlobalHelper.GetLastUpdate() < 7)
if (auto && int.Parse(DateTime.Now.ToString("yyyyMMdd")) - GlobalHelper.GetLastUpdate() < 7)
{
Environment.Exit(0);
}
Expand Down

0 comments on commit 0fdb507

Please sign in to comment.