change version comparisons
it is now possible to locally use newer application or driver versions without envyupdate yelling at you.
This commit is contained in:
parent
b99a2ee8c9
commit
fff0d76b83
3 changed files with 8 additions and 5 deletions
|
@ -9,7 +9,7 @@ namespace EnvyUpdate
|
|||
public static readonly string exeloc = System.Reflection.Assembly.GetEntryAssembly().Location;
|
||||
public static readonly string exepath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\";
|
||||
public static readonly string startmenu = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu);
|
||||
public static readonly string version = "2.2";
|
||||
public static readonly float version = 2.3F;
|
||||
public static readonly string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\envyupdate\\";
|
||||
public static readonly string startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
|
||||
public static readonly string desktopOverride = exepath + "desktop.envy";
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace EnvyUpdate
|
|||
{
|
||||
try
|
||||
{
|
||||
if (Util.GetNewVer() != GlobalVars.version)
|
||||
if (Util.GetNewVer() > GlobalVars.version)
|
||||
{
|
||||
Util.UpdateApp();
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ namespace EnvyUpdate
|
|||
textblockOnline.Text = onlineDriv;
|
||||
c.Dispose();
|
||||
|
||||
if (localDriv != onlineDriv)
|
||||
if (float.Parse(localDriv) < float.Parse(onlineDriv))
|
||||
{
|
||||
textblockOnline.Foreground = Brushes.Red;
|
||||
buttonDL.Visibility = Visibility.Visible;
|
||||
|
|
|
@ -103,7 +103,7 @@ namespace EnvyUpdate
|
|||
/// Checks for newest EnvyUpdate version.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetNewVer()
|
||||
public static float GetNewVer()
|
||||
{
|
||||
// This will fetch the most recent version's tag on GitHub.
|
||||
string updPath = "https://api.github.com/repos/fyr77/envyupdate/releases/latest";
|
||||
|
@ -113,7 +113,10 @@ namespace EnvyUpdate
|
|||
wc.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 10.0; Trident/7.0; rv:11.0) like Gecko");
|
||||
string webData = wc.DownloadString(updPath);
|
||||
dynamic data = JsonConvert.DeserializeObject(webData);
|
||||
string version = data.tag_name;
|
||||
|
||||
// I am not catching a possible parsing exception, because I cannot think of any way it could happen.
|
||||
// If there is no internet connection, it should already throw when using the web client.
|
||||
float version = float.Parse(data.tag_name);
|
||||
|
||||
return version;
|
||||
}
|
||||
|
|
Reference in a new issue