Skip to content

Commit

Permalink
Merge branch 'hotfix/1.1.1' into support/1.x
Browse files Browse the repository at this point in the history
* hotfix/1.1.1:
  (#977) Ensure that the correct public key is used
  (#977) Change variable names to be more specific
  (maint) Remove duplicates from csproj files
  (#978) Always delete outdated cache file
  • Loading branch information
gep13 committed Jan 26, 2023
2 parents 2da8af0 + 5e440fe commit d94e381
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 16 deletions.
12 changes: 9 additions & 3 deletions Source/ChocolateyGui.Common.Windows/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseOfficial|AnyCPU'">
<OutputPath>bin\ReleaseOfficial\</OutputPath>
<DefineConstants>TRACE;CODE_ANALYSIS;CODE_ANALYSIS;FORCE_CHOCOLATEY_OFFICIAL_KEY</DefineConstants>
<DefineConstants>TRACE;CODE_ANALYSIS;FORCE_CHOCOLATEY_OFFICIAL_KEY</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down
10 changes: 10 additions & 0 deletions Source/ChocolateyGui.Common.Windows/Services/ChocolateyService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ public async Task<IReadOnlyList<OutdatedPackage>> 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)
Expand Down
2 changes: 1 addition & 1 deletion Source/ChocolateyGui.Common/ChocolateyGui.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseOfficial|AnyCPU'">
<OutputPath>bin\ReleaseOfficial\</OutputPath>
<DefineConstants>TRACE;CODE_ANALYSIS;CODE_ANALYSIS;FORCE_CHOCOLATEY_OFFICIAL_KEY</DefineConstants>
<DefineConstants>TRACE;CODE_ANALYSIS;FORCE_CHOCOLATEY_OFFICIAL_KEY</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down
4 changes: 2 additions & 2 deletions Source/ChocolateyGui.Common/Startup/AutoFacConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Source/ChocolateyGui/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Source/ChocolateyGui/ChocolateyGui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseOfficial|AnyCPU'">
<OutputPath>bin\ReleaseOfficial\</OutputPath>
<DefineConstants>TRACE;CODE_ANALYSIS;CODE_ANALYSIS;FORCE_CHOCOLATEY_OFFICIAL_KEY</DefineConstants>
<DefineConstants>TRACE;CODE_ANALYSIS;FORCE_CHOCOLATEY_OFFICIAL_KEY</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down
12 changes: 9 additions & 3 deletions Source/ChocolateyGuiCli/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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);
}
}
}
2 changes: 1 addition & 1 deletion Source/ChocolateyGuiCli/ChocolateyGuiCli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseOfficial|AnyCPU'">
<OutputPath>bin\ReleaseOfficial\</OutputPath>
<DefineConstants>TRACE;CODE_ANALYSIS;CODE_ANALYSIS;FORCE_CHOCOLATEY_OFFICIAL_KEY</DefineConstants>
<DefineConstants>TRACE;CODE_ANALYSIS;FORCE_CHOCOLATEY_OFFICIAL_KEY</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down
4 changes: 2 additions & 2 deletions Source/ChocolateyGuiCli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d94e381

Please sign in to comment.