cleanup code and update packages
This commit is contained in:
parent
b7ae273fa3
commit
2b523fa7d4
6 changed files with 38 additions and 32 deletions
|
@ -140,7 +140,7 @@
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
|
<Error Condition="!Exists('..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
|
||||||
<Error Condition="!Exists('..\packages\Fody.6.0.5\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.6.0.5\build\Fody.targets'))" />
|
<Error Condition="!Exists('..\packages\Fody.6.1.2\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.6.1.2\build\Fody.targets'))" />
|
||||||
</Target>
|
</Target>
|
||||||
<Import Project="..\packages\Fody.6.0.5\build\Fody.targets" Condition="Exists('..\packages\Fody.6.0.5\build\Fody.targets')" />
|
<Import Project="..\packages\Fody.6.1.2\build\Fody.targets" Condition="Exists('..\packages\Fody.6.1.2\build\Fody.targets')" />
|
||||||
</Project>
|
</Project>
|
|
@ -1,8 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Windows;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
|
|
||||||
|
@ -13,20 +13,22 @@ namespace EnvyUpdate
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class MainWindow : Window
|
public partial class MainWindow : Window
|
||||||
{
|
{
|
||||||
string localDriv = null;
|
private string localDriv = null;
|
||||||
string onlineDriv = null;
|
private string onlineDriv = null;
|
||||||
readonly string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\envyupdate\\";
|
private readonly string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\envyupdate\\";
|
||||||
readonly string startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
|
private readonly string startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
|
||||||
string gpuURL = null;
|
private string gpuURL = null;
|
||||||
readonly string exeloc = System.Reflection.Assembly.GetEntryAssembly().Location;
|
private readonly string exeloc = System.Reflection.Assembly.GetEntryAssembly().Location;
|
||||||
readonly string exepath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\";
|
private readonly string exepath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\";
|
||||||
readonly string startmenu = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu);
|
private readonly string startmenu = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu);
|
||||||
readonly string version = "1.1";
|
private readonly string version = "1.1";
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Title += " " + version;
|
Title += " " + version;
|
||||||
|
|
||||||
|
// Check if EnvyUpdate is already running
|
||||||
if (Util.IsInstanceOpen("EnvyUpdate"))
|
if (Util.IsInstanceOpen("EnvyUpdate"))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Application is already running.");
|
MessageBox.Show("Application is already running.");
|
||||||
|
@ -37,6 +39,7 @@ namespace EnvyUpdate
|
||||||
Directory.CreateDirectory(appdata);
|
Directory.CreateDirectory(appdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if application is in Autorun mode and update
|
||||||
if (exepath == appdata)
|
if (exepath == appdata)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -102,6 +105,7 @@ namespace EnvyUpdate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Load()
|
private void Load()
|
||||||
{
|
{
|
||||||
FileInfo f = new FileInfo(appdata + "nvidia-update.txt");
|
FileInfo f = new FileInfo(appdata + "nvidia-update.txt");
|
||||||
|
@ -143,6 +147,7 @@ namespace EnvyUpdate
|
||||||
Hide();
|
Hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Load(string[] files)
|
private void Load(string[] files)
|
||||||
{
|
{
|
||||||
FileInfo f = new FileInfo(files[0]);
|
FileInfo f = new FileInfo(files[0]);
|
||||||
|
@ -184,6 +189,7 @@ namespace EnvyUpdate
|
||||||
else
|
else
|
||||||
textblockOnline.Foreground = Brushes.Green;
|
textblockOnline.Foreground = Brushes.Green;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonDL_Click(object sender, RoutedEventArgs e)
|
private void buttonDL_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
System.Diagnostics.Process.Start(gpuURL);
|
System.Diagnostics.Process.Start(gpuURL);
|
||||||
|
@ -247,4 +253,4 @@ namespace EnvyUpdate
|
||||||
Application.Current.Shutdown();
|
Application.Current.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace EnvyUpdate
|
namespace EnvyUpdate
|
||||||
{
|
{
|
||||||
class Notify
|
internal class Notify
|
||||||
{
|
{
|
||||||
public static void ShowDrivUpdatePopup()
|
public static void ShowDrivUpdatePopup()
|
||||||
{
|
{
|
||||||
|
@ -16,4 +16,4 @@ namespace EnvyUpdate
|
||||||
}, onClick: Util.ShowMain);
|
}, onClick: Util.ShowMain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,10 +1,4 @@
|
||||||
using System;
|
namespace EnvyUpdate
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace EnvyUpdate
|
|
||||||
{
|
{
|
||||||
public static class StringExt
|
public static class StringExt
|
||||||
{
|
{
|
||||||
|
@ -14,4 +8,4 @@ namespace EnvyUpdate
|
||||||
return value.Length <= maxLength ? value : value.Substring(0, maxLength);
|
return value.Length <= maxLength ? value : value.Substring(0, maxLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,15 +1,15 @@
|
||||||
using System;
|
using IWshRuntimeLibrary;
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Management;
|
using System.Management;
|
||||||
using System.IO;
|
|
||||||
using IWshRuntimeLibrary;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
namespace EnvyUpdate
|
namespace EnvyUpdate
|
||||||
{
|
{
|
||||||
class Util
|
internal class Util
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses GPU info from a cookie file
|
/// Parses GPU info from a cookie file
|
||||||
|
@ -35,6 +35,7 @@ namespace EnvyUpdate
|
||||||
int lastno = Convert.ToInt32(found.Split().Last());
|
int lastno = Convert.ToInt32(found.Split().Last());
|
||||||
return lastno;
|
return lastno;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets local driver version.
|
/// Gets local driver version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -68,6 +69,7 @@ namespace EnvyUpdate
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a standard Windows shortcut.
|
/// Creates a standard Windows shortcut.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -85,6 +87,7 @@ namespace EnvyUpdate
|
||||||
shortcut.TargetPath = targetFileLocation;
|
shortcut.TargetPath = targetFileLocation;
|
||||||
shortcut.Save();
|
shortcut.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsInstanceOpen(string name)
|
public static bool IsInstanceOpen(string name)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
@ -101,20 +104,23 @@ namespace EnvyUpdate
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ShowMain()
|
public static void ShowMain()
|
||||||
{
|
{
|
||||||
Application.Current.MainWindow.Show();
|
Application.Current.MainWindow.Show();
|
||||||
Application.Current.MainWindow.WindowState = WindowState.Normal;
|
Application.Current.MainWindow.WindowState = WindowState.Normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetNewVer()
|
public static string GetNewVer()
|
||||||
{
|
{
|
||||||
string updPath = "https://raw.githubusercontent.com/fyr77/EnvyUpdate/master/res/version.txt";
|
string updPath = "https://raw.githubusercontent.com/fyr77/EnvyUpdate/master/res/version.txt";
|
||||||
|
|
||||||
System.Net.WebClient wc = new System.Net.WebClient();
|
WebClient wc = new WebClient();
|
||||||
string webData = wc.DownloadString(updPath).Truncate(3);
|
string webData = wc.DownloadString(updPath).Truncate(3);
|
||||||
|
|
||||||
return webData;
|
return webData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the application by downloading the new version from Github and replacing the old file using a seperate CMD instance.
|
/// Updates the application by downloading the new version from Github and replacing the old file using a seperate CMD instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -144,4 +150,4 @@ namespace EnvyUpdate
|
||||||
Environment.Exit(2);
|
Environment.Exit(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Costura.Fody" version="4.1.0" targetFramework="net472" />
|
<package id="Costura.Fody" version="4.1.0" targetFramework="net472" />
|
||||||
<package id="Fody" version="6.0.5" targetFramework="net472" developmentDependency="true" />
|
<package id="Fody" version="6.1.2" targetFramework="net472" developmentDependency="true" />
|
||||||
<package id="Hardcodet.NotifyIcon.Wpf" version="1.0.8" targetFramework="net472" />
|
<package id="Hardcodet.NotifyIcon.Wpf" version="1.0.8" targetFramework="net472" />
|
||||||
<package id="Notifications.Wpf" version="0.1.1" targetFramework="net472" />
|
<package id="Notifications.Wpf" version="0.1.1" targetFramework="net472" />
|
||||||
</packages>
|
</packages>
|
Reference in a new issue