mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
Assign IsFirstTimeRun and IsUpgrade on setting load
This commit is contained in:
parent
aa8334f439
commit
3143e01a31
2 changed files with 5 additions and 15 deletions
|
@ -44,22 +44,10 @@ namespace ShareX.HelpersLib
|
||||||
public string ApplicationVersion { get; set; }
|
public string ApplicationVersion { get; set; }
|
||||||
|
|
||||||
[Browsable(false)]
|
[Browsable(false)]
|
||||||
public bool IsFirstTimeRun
|
public bool IsFirstTimeRun { get; private set; }
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return string.IsNullOrEmpty(ApplicationVersion);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Browsable(false)]
|
[Browsable(false)]
|
||||||
public bool IsUpgrade
|
public bool IsUpgrade { get; private set; }
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return !IsFirstTimeRun && Helpers.CompareApplicationVersion(ApplicationVersion) < 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void OnSettingsSaved(string filePath, bool result)
|
protected virtual void OnSettingsSaved(string filePath, bool result)
|
||||||
{
|
{
|
||||||
|
@ -103,6 +91,8 @@ public static T Load(string filePath)
|
||||||
if (setting != null)
|
if (setting != null)
|
||||||
{
|
{
|
||||||
setting.FilePath = filePath;
|
setting.FilePath = filePath;
|
||||||
|
setting.IsFirstTimeRun = string.IsNullOrEmpty(setting.ApplicationVersion);
|
||||||
|
setting.IsUpgrade = !setting.IsFirstTimeRun && Helpers.CompareApplicationVersion(setting.ApplicationVersion) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return setting;
|
return setting;
|
||||||
|
|
|
@ -140,7 +140,7 @@ private GitHubRelease GetLatestRelease(bool includePreRelease)
|
||||||
return latestRelease;
|
return latestRelease;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool UpdateReleaseInfo(GitHubRelease release, bool isPortable, bool isBrowserDownloadURL)
|
private bool UpdateReleaseInfo(GitHubRelease release, bool isPortable, bool isBrowserDownloadURL)
|
||||||
{
|
{
|
||||||
if (release != null && !string.IsNullOrEmpty(release.tag_name) && release.tag_name.Length > 1 && release.tag_name[0] == 'v')
|
if (release != null && !string.IsNullOrEmpty(release.tag_name) && release.tag_name.Length > 1 && release.tag_name[0] == 'v')
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue