Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8245955e9c |
@@ -15,7 +15,7 @@
|
|||||||
<UpdateRequired>false</UpdateRequired>
|
<UpdateRequired>false</UpdateRequired>
|
||||||
<MapFileExtensions>true</MapFileExtensions>
|
<MapFileExtensions>true</MapFileExtensions>
|
||||||
<ApplicationRevision>0</ApplicationRevision>
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
<ApplicationVersion>1.4.1</ApplicationVersion>
|
<ApplicationVersion>1.4.0</ApplicationVersion>
|
||||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
<ApplicationIcon>CarMgm_Icon.ico</ApplicationIcon>
|
<ApplicationIcon>CarMgm_Icon.ico</ApplicationIcon>
|
||||||
<AssemblyTitle>Car Manager 3</AssemblyTitle>
|
<AssemblyTitle>Car Manager 3</AssemblyTitle>
|
||||||
<Product>Car Manager 3</Product>
|
<Product>Car Manager 3</Product>
|
||||||
<Version>1.4.1</Version>
|
<Version>1.4.0</Version>
|
||||||
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace CarManagerV3
|
|||||||
{
|
{
|
||||||
if (Updater.IsUpdateAvailable(Properties.Settings.Default.AllowPrerelease))
|
if (Updater.IsUpdateAvailable(Properties.Settings.Default.AllowPrerelease))
|
||||||
{
|
{
|
||||||
UpdatePromptForm updatePrompt = new UpdatePromptForm(Updater.GetCurrentVersion(true), Updater.GetLatestVersion(Properties.Settings.Default.AllowPrerelease));
|
UpdatePromptForm updatePrompt = new UpdatePromptForm(Updater.GetCurrentVersion(), Updater.GetLatestVersion());
|
||||||
updatePrompt.ShowDialog();
|
updatePrompt.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -571,12 +571,12 @@ namespace CarManagerV3
|
|||||||
{
|
{
|
||||||
if (Updater.IsUpdateAvailable(Properties.Settings.Default.AllowPrerelease))
|
if (Updater.IsUpdateAvailable(Properties.Settings.Default.AllowPrerelease))
|
||||||
{
|
{
|
||||||
UpdatePromptForm updatePrompt = new UpdatePromptForm(Updater.GetCurrentVersion(true), Updater.GetLatestVersion(Properties.Settings.Default.AllowPrerelease));
|
UpdatePromptForm updatePrompt = new UpdatePromptForm(Updater.GetCurrentVersion(), Updater.GetLatestVersion());
|
||||||
updatePrompt.ShowDialog();
|
updatePrompt.ShowDialog();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.Show($"You are already using the latest version. \nYour Version: {Updater.GetCurrentVersion(true)} \nLatest Version: {Updater.GetLatestVersion(Properties.Settings.Default.AllowPrerelease)}", "No Updates Available", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show($"You are already using the latest version. ({Updater.GetCurrentVersion()})", "No Updates Available", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -18,10 +18,6 @@ namespace CarManagerV3.Forms
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
lblInstalledVersion.Text = lblInstalledVersion.Text.Replace("?.?.?", currentVersion);
|
lblInstalledVersion.Text = lblInstalledVersion.Text.Replace("?.?.?", currentVersion);
|
||||||
lblLatestVersion.Text = lblLatestVersion.Text.Replace("?.?.?", latestVersion);
|
lblLatestVersion.Text = lblLatestVersion.Text.Replace("?.?.?", latestVersion);
|
||||||
if (Updater.IsLatestVersionPrerelease())
|
|
||||||
{
|
|
||||||
lblLatestVersion.Text += " (Pre-release)";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +58,7 @@ namespace CarManagerV3.Forms
|
|||||||
|
|
||||||
private void btnReadChangelog_Click(object sender, EventArgs e)
|
private void btnReadChangelog_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Updater.OpenReleasePage();
|
Updater.openReleasePage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,29 +22,18 @@ namespace CarManagerV3.Manager
|
|||||||
private static readonly int CacheDurationMinutes = 60;
|
private static readonly int CacheDurationMinutes = 60;
|
||||||
private static bool cacheIncludesPrerelease = false;
|
private static bool cacheIncludesPrerelease = false;
|
||||||
private static readonly string debugVersion = null;//"1.2.0";
|
private static readonly string debugVersion = null;//"1.2.0";
|
||||||
private static bool isLatestVersionPrerelease = false;
|
|
||||||
|
|
||||||
public static string GetCurrentVersion(bool cutTrailingZeros = false)
|
public static string GetCurrentVersion()
|
||||||
{
|
{
|
||||||
//DEBUG::
|
//DEBUG::
|
||||||
if (debugVersion != null)
|
if(debugVersion != null)
|
||||||
{
|
{
|
||||||
return debugVersion;
|
return debugVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
var asm = Assembly.GetEntryAssembly()!;
|
var asm = Assembly.GetEntryAssembly()!;
|
||||||
Version v = asm.GetName().Version ?? new Version(0, 0, 0, 0);
|
Version v = asm.GetName().Version ?? new Version(0, 0, 0, 0);
|
||||||
string VersionString = v.ToString();
|
return v.ToString();
|
||||||
if(cutTrailingZeros)
|
|
||||||
{
|
|
||||||
// Remove trailing .0 parts
|
|
||||||
while (VersionString.EndsWith(".0"))
|
|
||||||
{
|
|
||||||
VersionString = VersionString.Substring(0, VersionString.Length - 2);
|
|
||||||
}
|
|
||||||
return VersionString;
|
|
||||||
}
|
|
||||||
return VersionString;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsCacheValid(bool includePreRelease = false)
|
private static bool IsCacheValid(bool includePreRelease = false)
|
||||||
@@ -83,7 +72,6 @@ namespace CarManagerV3.Manager
|
|||||||
var content = response.Content.ReadAsStringAsync().Result;
|
var content = response.Content.ReadAsStringAsync().Result;
|
||||||
dynamic release = Newtonsoft.Json.JsonConvert.DeserializeObject(content);
|
dynamic release = Newtonsoft.Json.JsonConvert.DeserializeObject(content);
|
||||||
latestVersion = release.tag_name;
|
latestVersion = release.tag_name;
|
||||||
isLatestVersionPrerelease = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If pre-release is requested, check for the latest pre-release version
|
// If pre-release is requested, check for the latest pre-release version
|
||||||
@@ -103,7 +91,6 @@ namespace CarManagerV3.Manager
|
|||||||
if (IsNewerVersion(preReleaseVersion, latestVersion))
|
if (IsNewerVersion(preReleaseVersion, latestVersion))
|
||||||
{
|
{
|
||||||
latestVersion = preReleaseVersion;
|
latestVersion = preReleaseVersion;
|
||||||
isLatestVersionPrerelease = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -150,11 +137,11 @@ namespace CarManagerV3.Manager
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (downloadUrl != null)
|
if (downloadUrl != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// Download the installer to the users set Data dir, run it, and then exit the application.
|
// Download the installer to the users set Data dir, run it, and then exit the application.
|
||||||
string tempFilePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), $"CarManagerInstaller_{latestVersion}.msi");
|
string tempFilePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), $"CarManagerInstaller_{latestVersion}.msi");
|
||||||
using (var downloadClient = new System.Net.WebClient())
|
using (var downloadClient = new System.Net.WebClient())
|
||||||
@@ -168,8 +155,8 @@ namespace CarManagerV3.Manager
|
|||||||
UseShellExecute = true
|
UseShellExecute = true
|
||||||
};
|
};
|
||||||
System.Diagnostics.Process.Start(processStartInfo);
|
System.Diagnostics.Process.Start(processStartInfo);
|
||||||
|
|
||||||
|
|
||||||
Application.Exit();
|
Application.Exit();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -193,9 +180,9 @@ namespace CarManagerV3.Manager
|
|||||||
return IsNewerVersion(latestVersion, currentVersion);
|
return IsNewerVersion(latestVersion, currentVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void OpenReleasePage(string version = null)
|
public static void openReleasePage(string version = null)
|
||||||
{
|
{
|
||||||
if (version == null)
|
if(version == null)
|
||||||
{
|
{
|
||||||
version = GetLatestVersion(true);
|
version = GetLatestVersion(true);
|
||||||
}
|
}
|
||||||
@@ -206,11 +193,5 @@ namespace CarManagerV3.Manager
|
|||||||
UseShellExecute = true
|
UseShellExecute = true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsLatestVersionPrerelease()
|
|
||||||
{
|
|
||||||
// Ensure we have the latest version info in cache
|
|
||||||
return isLatestVersionPrerelease;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user