diff --git a/Source/ChocolateyGui.Common.Windows/Bootstrapper.cs b/Source/ChocolateyGui.Common.Windows/Bootstrapper.cs index 86c62c5c6..671075bbc 100644 --- a/Source/ChocolateyGui.Common.Windows/Bootstrapper.cs +++ b/Source/ChocolateyGui.Common.Windows/Bootstrapper.cs @@ -48,8 +48,8 @@ public class Bootstrapper : BootstrapperBase public static readonly string ChocolateyGuiCommonAssemblySimpleName = "ChocolateyGui.Common"; public static readonly string ChocolateyGuiCommonWindowsAssemblySimpleName = "ChocolateyGui.Common.Windows"; - public static readonly string UnofficialChocolateyPublicKey = "ffc115b9f4eb5c26"; - public static readonly string OfficialChocolateyPublicKey = "dfd1909b30b79d8b"; + public static readonly string UnofficialChocolateyGuiPublicKey = "ffc115b9f4eb5c26"; + public static readonly string OfficialChocolateyGuiPublicKey = "dfd1909b30b79d8b"; public static readonly string Name = "Chocolatey GUI"; @@ -103,7 +103,13 @@ protected override void Configure() Logger = Log.Logger = logConfig.CreateLogger(); - Container = AutoFacConfiguration.RegisterAutoFac(LicensedChocolateyGuiAssemblySimpleName, LicensedGuiAssemblyLocation); +#if FORCE_CHOCOLATEY_OFFICIAL_KEY + var chocolateyGuiPublicKey = OfficialChocolateyGuiPublicKey; +#else + var chocolateyGuiPublicKey = UnofficialChocolateyGuiPublicKey; +#endif + + Container = AutoFacConfiguration.RegisterAutoFac(LicensedChocolateyGuiAssemblySimpleName, LicensedGuiAssemblyLocation, chocolateyGuiPublicKey); } protected override async void OnStartup(object sender, StartupEventArgs e) diff --git a/Source/ChocolateyGui.Common.Windows/ChocolateyGui.Common.Windows.csproj b/Source/ChocolateyGui.Common.Windows/ChocolateyGui.Common.Windows.csproj index 016ce723e..1c4de67f0 100644 --- a/Source/ChocolateyGui.Common.Windows/ChocolateyGui.Common.Windows.csproj +++ b/Source/ChocolateyGui.Common.Windows/ChocolateyGui.Common.Windows.csproj @@ -43,7 +43,7 @@ bin\ReleaseOfficial\ - TRACE;CODE_ANALYSIS;CODE_ANALYSIS;FORCE_CHOCOLATEY_OFFICIAL_KEY + TRACE;CODE_ANALYSIS;FORCE_CHOCOLATEY_OFFICIAL_KEY true pdbonly AnyCPU diff --git a/Source/ChocolateyGui.Common.Windows/Services/ChocolateyService.cs b/Source/ChocolateyGui.Common.Windows/Services/ChocolateyService.cs index 39397d53c..e2f43a00a 100644 --- a/Source/ChocolateyGui.Common.Windows/Services/ChocolateyService.cs +++ b/Source/ChocolateyGui.Common.Windows/Services/ChocolateyService.cs @@ -146,6 +146,16 @@ public async Task> GetOutdatedPackages(bool inclu try { + // The XmlService won't create a new file, if the file already exists with the same hash, + // i.e. the list of outdated packages hasn't changed. Currently, we check for new outdated + // packages, when the serialized file has become old/stale, so we NEED the file to be re-written + // when this check is done, so that it isn't always doing the check. Therefore, when we are + // getting ready to serialize the list of outdated packages, if the file already exists, delete it. + if (_fileSystem.file_exists(outdatedPackagesFile)) + { + _fileSystem.delete_file(outdatedPackagesFile); + } + _xmlService.serialize(results, outdatedPackagesFile); } catch (Exception ex) diff --git a/Source/ChocolateyGui.Common/ChocolateyGui.Common.csproj b/Source/ChocolateyGui.Common/ChocolateyGui.Common.csproj index 6630edf82..2361face0 100644 --- a/Source/ChocolateyGui.Common/ChocolateyGui.Common.csproj +++ b/Source/ChocolateyGui.Common/ChocolateyGui.Common.csproj @@ -39,7 +39,7 @@ bin\ReleaseOfficial\ - TRACE;CODE_ANALYSIS;CODE_ANALYSIS;FORCE_CHOCOLATEY_OFFICIAL_KEY + TRACE;CODE_ANALYSIS;FORCE_CHOCOLATEY_OFFICIAL_KEY true pdbonly AnyCPU diff --git a/Source/ChocolateyGui.Common/Startup/AutoFacConfiguration.cs b/Source/ChocolateyGui.Common/Startup/AutoFacConfiguration.cs index ef7bd02f4..616061d0b 100644 --- a/Source/ChocolateyGui.Common/Startup/AutoFacConfiguration.cs +++ b/Source/ChocolateyGui.Common/Startup/AutoFacConfiguration.cs @@ -20,7 +20,7 @@ public static class AutoFacConfiguration "Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Justification = "This is really a requirement due to required registrations.")] - public static IContainer RegisterAutoFac(string chocolateyGuiAssemblySimpleName, string licensedGuiAssemblyLocation) + public static IContainer RegisterAutoFac(string chocolateyGuiAssemblySimpleName, string licensedGuiAssemblyLocation, string publicKey) { var builder = new ContainerBuilder(); builder.RegisterAssemblyModules(System.Reflection.Assembly.GetCallingAssembly()); @@ -32,7 +32,7 @@ public static IContainer RegisterAutoFac(string chocolateyGuiAssemblySimpleName, { var licensedGuiAssembly = AssemblyResolution.resolve_or_load_assembly( chocolateyGuiAssemblySimpleName, - chocolatey.infrastructure.app.ApplicationParameters.OfficialChocolateyPublicKey, + publicKey, licensedGuiAssemblyLocation); if (licensedGuiAssembly != null) diff --git a/Source/ChocolateyGui/App.xaml.cs b/Source/ChocolateyGui/App.xaml.cs index bd9dfbaf8..5b8e5343a 100644 --- a/Source/ChocolateyGui/App.xaml.cs +++ b/Source/ChocolateyGui/App.xaml.cs @@ -59,9 +59,9 @@ public App() } #if FORCE_CHOCOLATEY_OFFICIAL_KEY - var chocolateyGuiPublicKey = Bootstrapper.OfficialChocolateyPublicKey; + var chocolateyGuiPublicKey = Bootstrapper.OfficialChocolateyGuiPublicKey; #else - var chocolateyGuiPublicKey = Bootstrapper.UnofficialChocolateyPublicKey; + var chocolateyGuiPublicKey = Bootstrapper.UnofficialChocolateyGuiPublicKey; #endif if (AssemblyResolver.DoesPublicKeyTokenMatch(requestedAssembly, chocolateyGuiPublicKey) diff --git a/Source/ChocolateyGui/ChocolateyGui.csproj b/Source/ChocolateyGui/ChocolateyGui.csproj index 8b9f4533e..fbdb87cab 100644 --- a/Source/ChocolateyGui/ChocolateyGui.csproj +++ b/Source/ChocolateyGui/ChocolateyGui.csproj @@ -74,7 +74,7 @@ bin\ReleaseOfficial\ - TRACE;CODE_ANALYSIS;CODE_ANALYSIS;FORCE_CHOCOLATEY_OFFICIAL_KEY + TRACE;CODE_ANALYSIS;FORCE_CHOCOLATEY_OFFICIAL_KEY true pdbonly AnyCPU diff --git a/Source/ChocolateyGuiCli/Bootstrapper.cs b/Source/ChocolateyGuiCli/Bootstrapper.cs index 76f54ce55..180b0daf0 100644 --- a/Source/ChocolateyGuiCli/Bootstrapper.cs +++ b/Source/ChocolateyGuiCli/Bootstrapper.cs @@ -36,8 +36,8 @@ public static class Bootstrapper public static readonly string ChocolateyGuiCommonAssemblySimpleName = "ChocolateyGui.Common"; public static readonly string ChocolateyGuiCommonWindowsAssemblySimpleName = "ChocolateyGui.Common.Windows"; - public static readonly string UnofficialChocolateyPublicKey = "ffc115b9f4eb5c26"; - public static readonly string OfficialChocolateyPublicKey = "dfd1909b30b79d8b"; + public static readonly string UnofficialChocolateyGuiPublicKey = "ffc115b9f4eb5c26"; + public static readonly string OfficialChocolateyGuiPublicKey = "dfd1909b30b79d8b"; public static readonly string Name = "Chocolatey GUI"; @@ -72,7 +72,13 @@ internal static void Configure() Logger = Log.Logger = logConfig.CreateLogger(); - Container = AutoFacConfiguration.RegisterAutoFac(LicensedChocolateyGuiAssemblySimpleName, LicensedGuiAssemblyLocation); +#if FORCE_CHOCOLATEY_OFFICIAL_KEY + var chocolateyGuiPublicKey = OfficialChocolateyGuiPublicKey; +#else + var chocolateyGuiPublicKey = UnofficialChocolateyGuiPublicKey; +#endif + + Container = AutoFacConfiguration.RegisterAutoFac(LicensedChocolateyGuiAssemblySimpleName, LicensedGuiAssemblyLocation, chocolateyGuiPublicKey); } } } \ No newline at end of file diff --git a/Source/ChocolateyGuiCli/ChocolateyGuiCli.csproj b/Source/ChocolateyGuiCli/ChocolateyGuiCli.csproj index 74bbb5847..95b7cfcd6 100644 --- a/Source/ChocolateyGuiCli/ChocolateyGuiCli.csproj +++ b/Source/ChocolateyGuiCli/ChocolateyGuiCli.csproj @@ -43,7 +43,7 @@ bin\ReleaseOfficial\ - TRACE;CODE_ANALYSIS;CODE_ANALYSIS;FORCE_CHOCOLATEY_OFFICIAL_KEY + TRACE;CODE_ANALYSIS;FORCE_CHOCOLATEY_OFFICIAL_KEY true pdbonly AnyCPU diff --git a/Source/ChocolateyGuiCli/Program.cs b/Source/ChocolateyGuiCli/Program.cs index 4d1f7e0e2..ccb4d3924 100644 --- a/Source/ChocolateyGuiCli/Program.cs +++ b/Source/ChocolateyGuiCli/Program.cs @@ -51,9 +51,9 @@ private static void AddAssemblyResolver() } #if FORCE_CHOCOLATEY_OFFICIAL_KEY - var chocolateyGuiPublicKey = Bootstrapper.OfficialChocolateyPublicKey; + var chocolateyGuiPublicKey = Bootstrapper.OfficialChocolateyGuiPublicKey; #else - var chocolateyGuiPublicKey = Bootstrapper.UnofficialChocolateyPublicKey; + var chocolateyGuiPublicKey = Bootstrapper.UnofficialChocolateyGuiPublicKey; #endif if (AssemblyResolver.DoesPublicKeyTokenMatch(requestedAssembly, chocolateyGuiPublicKey)