From de5b06397f7a9b9fa0947d232c443ccf803caf48 Mon Sep 17 00:00:00 2001 From: Andrew Date: Sat, 9 Jan 2016 16:55:26 -0500 Subject: [PATCH] Fix Update Check --- SteamCleaner/App.xaml.cs | 5 ++- SteamCleaner/ConfirmationDialog.xaml | 2 +- SteamCleaner/FodyWeavers.xml | 5 +++ SteamCleaner/MainWindowViewModel.cs | 8 ++++- SteamCleaner/SteamCleaner.csproj | 49 ++++++++++++++++++++++++++++ SteamCleaner/Utilities/Tools.cs | 19 +++++++---- SteamCleaner/packages.config | 2 ++ 7 files changed, 81 insertions(+), 9 deletions(-) create mode 100644 SteamCleaner/FodyWeavers.xml diff --git a/SteamCleaner/App.xaml.cs b/SteamCleaner/App.xaml.cs index 20e555e..e335130 100644 --- a/SteamCleaner/App.xaml.cs +++ b/SteamCleaner/App.xaml.cs @@ -4,6 +4,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows; +using SteamCleaner.Utilities; namespace SteamCleaner { @@ -15,12 +16,14 @@ public partial class App : Application void AppStartup(object sender, StartupEventArgs args) { - + + var mainWindow = new MainWindow { DataContext = new MainWindowViewModel() }; mainWindow.Show(); + Tools.CheckForUpdates(); } } } diff --git a/SteamCleaner/ConfirmationDialog.xaml b/SteamCleaner/ConfirmationDialog.xaml index 4881b6b..d6d9a3a 100644 --- a/SteamCleaner/ConfirmationDialog.xaml +++ b/SteamCleaner/ConfirmationDialog.xaml @@ -11,7 +11,7 @@ - + diff --git a/SteamCleaner/FodyWeavers.xml b/SteamCleaner/FodyWeavers.xml new file mode 100644 index 0000000..2e6d4a7 --- /dev/null +++ b/SteamCleaner/FodyWeavers.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/SteamCleaner/MainWindowViewModel.cs b/SteamCleaner/MainWindowViewModel.cs index 0649cf3..42f9978 100644 --- a/SteamCleaner/MainWindowViewModel.cs +++ b/SteamCleaner/MainWindowViewModel.cs @@ -27,6 +27,7 @@ public MainWindowViewModel() //TODO run on a background thread, add spinner etc RunRefresh(); + } @@ -62,7 +63,6 @@ private void RunRefresh() _filesInternal.Add(fileViewModel); Statistics = CleanerUtilities.TotalFiles() + " files have been found (" + CleanerUtilities.TotalTakenSpace() + ") "; - } private async void RunClean() @@ -70,6 +70,12 @@ private async void RunClean() await CleanerUtilities.CleanData(); RunRefresh(); + + } + + private async void CheckForUpdate() + { + Tools.CheckForUpdates(); } public event PropertyChangedEventHandler PropertyChanged; diff --git a/SteamCleaner/SteamCleaner.csproj b/SteamCleaner/SteamCleaner.csproj index 40e96c1..c1bdfd8 100644 --- a/SteamCleaner/SteamCleaner.csproj +++ b/SteamCleaner/SteamCleaner.csproj @@ -13,6 +13,8 @@ 512 true {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + AnyCPU @@ -136,7 +138,54 @@ MSBuild:Compile + + + + + + + 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}. + + + + + + + + + + + + + + + +(); +var attribute = config.Attribute("ExcludeAssemblies"); +if (attribute != null) + foreach (var item in attribute.Value.Split('|').Select(x => x.Trim()).Where(x => x != string.Empty)) + excludedAssemblies.Add(item); +var element = config.Element("ExcludeAssemblies"); +if (element != null) + foreach (var item in element.Value.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).Where(x => x != string.Empty)) + excludedAssemblies.Add(item); + +var filesToCleanup = Files.Select(f => f.ItemSpec).Where(f => !excludedAssemblies.Contains(Path.GetFileNameWithoutExtension(f), StringComparer.InvariantCultureIgnoreCase)); + +foreach (var item in filesToCleanup) + File.Delete(item); +]]> + + + + +