Skip to content

Commit

Permalink
Merge pull request #11 from atc-net/feature/maintenance
Browse files Browse the repository at this point in the history
Feature/maintenance
  • Loading branch information
davidkallesen authored Nov 9, 2023
2 parents ade9863 + 3178a6d commit c060214
Show file tree
Hide file tree
Showing 19 changed files with 268 additions and 82 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/post-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,23 @@ jobs:
with:
setAllVars: true

# - name: ⚙️ Setup dotnet 7.0.x
# uses: actions/setup-dotnet@v1
# with:
# dotnet-version: '7.0.x'
- name: ⚙️ Setup dotnet 7.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'

# - name: ⚙️ Set up JDK 11
# uses: actions/setup-java@v1
# with:
# java-version: 1.11
- name: ⚙️ Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu'

# - name: 📐 Ensure nuget.org added as package source on Windows
# run: dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org --configfile $env:APPDATA\NuGet\NuGet.Config
# continue-on-error: true
- name: 📐 Ensure nuget.org added as package source on Windows
run: dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org --configfile $env:APPDATA\NuGet\NuGet.Config
continue-on-error: true

# - name: 🔁 Restore packages
# run: dotnet restore Atc.Installer-WithoutSetup.sln
- name: 🔁 Restore packages
run: dotnet restore Atc.Installer-WithoutSetup.sln

# - name: 🛠️ Build
# run: dotnet build Atc.Installer-WithoutSetup.sln -c Release --no-restore /p:UseSourceLink=true
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<ItemGroup Label="Code Analyzers">
<PackageReference Include="AsyncFixer" Version="1.6.0" PrivateAssets="All" />
<PackageReference Include="Asyncify" Version="0.9.7" PrivateAssets="All" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.103" PrivateAssets="All" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.105" PrivateAssets="All" />
<PackageReference Include="SecurityCodeScan.VS2019" Version="5.6.7" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.507" PrivateAssets="All" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.12.0.78982" PrivateAssets="All" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ItemGroup>
<PackageReference Include="Atc" Version="2.0.386" />
<PackageReference Include="Azure.Identity" Version="1.10.3" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.19.0-beta.1" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.19.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,36 @@ namespace System.IO;

public static class DirectoryInfoExtensions
{
public static bool ExistsAndContainsFiles(
this DirectoryInfo directoryInfo,
string searchPattern = "*",
bool useRecursive = true)
{
ArgumentNullException.ThrowIfNull(directoryInfo);

var searchOption = useRecursive
? SearchOption.AllDirectories
: SearchOption.TopDirectoryOnly;

return Directory.Exists(directoryInfo.FullName) &&
Directory.GetFiles(directoryInfo.FullName, searchPattern, searchOption).Length > 0;
}

public static bool ExistsAndContainsNoFiles(
this DirectoryInfo directoryInfo,
string searchPattern = "*",
bool useRecursive = true)
{
ArgumentNullException.ThrowIfNull(directoryInfo);

var searchOption = useRecursive
? SearchOption.AllDirectories
: SearchOption.TopDirectoryOnly;

return Directory.Exists(directoryInfo.FullName) &&
Directory.GetFiles(directoryInfo.FullName, searchPattern, searchOption).Length == 0;
}

public static void CopyAll(
this DirectoryInfo source,
DirectoryInfo destination,
Expand All @@ -15,6 +45,11 @@ public static void CopyAll(
ArgumentNullException.ThrowIfNull(source);
ArgumentNullException.ThrowIfNull(destination);

if (!Directory.Exists(source.FullName))
{
return;
}

if (Directory.Exists(destination.FullName))
{
if (deleteAllFromDestinationBeforeCopy)
Expand Down
14 changes: 14 additions & 0 deletions src/Atc.Installer.Integration/Helpers/DirectoryHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Atc.Installer.Integration.Helpers;

public static class DirectoryHelper
{
public static bool ExistsAndContainsFiles(
string? folderPath)
=> folderPath is not null &&
new DirectoryInfo(folderPath).ExistsAndContainsFiles();

public static bool ExistsAndContainsNoFiles(
string? folderPath)
=> folderPath is not null &&
new DirectoryInfo(folderPath).ExistsAndContainsNoFiles();
}
6 changes: 3 additions & 3 deletions src/Atc.Installer.Wpf.App/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
[assembly: AssemblyCompany("atc-net")]
[assembly: AssemblyProduct("Atc.Installer")]
[assembly: AssemblyTitle("Atc.Installer")]
[assembly: AssemblyVersion("1.0.11.0")]
[assembly: AssemblyInformationalVersion("1.0.11.0")]
[assembly: AssemblyFileVersion("1.0.11.0")]
[assembly: AssemblyVersion("1.0.12.0")]
[assembly: AssemblyInformationalVersion("1.0.12.0")]
[assembly: AssemblyFileVersion("1.0.12.0")]
[assembly: System.Resources.NeutralResourcesLanguage("en")]
[assembly: System.Runtime.Versioning.TargetPlatform("Windows7.0")]
[assembly: System.Runtime.Versioning.SupportedOSPlatform("Windows7.0")]
8 changes: 4 additions & 4 deletions src/Atc.Installer.Wpf.App/Atc.Installer.Wpf.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Atc.Wpf" Version="2.0.285" />
<PackageReference Include="Atc.Wpf.Controls" Version="2.0.285" />
<PackageReference Include="Atc.Wpf.FontIcons" Version="2.0.285" />
<PackageReference Include="Atc.Wpf.Theming" Version="2.0.285" />
<PackageReference Include="Atc.Wpf" Version="2.0.290" />
<PackageReference Include="Atc.Wpf.Controls" Version="2.0.290" />
<PackageReference Include="Atc.Wpf.FontIcons" Version="2.0.290" />
<PackageReference Include="Atc.Wpf.Theming" Version="2.0.290" />
<PackageReference Include="ClosedXML" Version="0.104.0-preview2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0-rc.2.23479.6" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0-rc.2.23479.6" />
Expand Down
1 change: 1 addition & 0 deletions src/Atc.Installer.Wpf.App/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
global using Atc.Installer.Integration;
global using Atc.Installer.Integration.Azure;
global using Atc.Installer.Integration.ElasticSearch;
global using Atc.Installer.Integration.Helpers;
global using Atc.Installer.Integration.InstallationConfigurations;
global using Atc.Installer.Integration.InternetInformationServer;
global using Atc.Installer.Integration.PostgreSql;
Expand Down
18 changes: 18 additions & 0 deletions src/Atc.Installer.Wpf.App/MainWindowViewModel_Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ private async Task DownloadInstallationFilesFromAzureStorageAccountCommandHandle
GetComponentsWithInstallationFileContentHash())
.ConfigureAwait(true);

var handledUnpackedZipFolderPaths = new List<string>();
foreach (var vm in ComponentProviders)
{
var fileInfo = componentFiles.FirstOrDefault(x => x.Name.StartsWith(vm.Name, StringComparison.OrdinalIgnoreCase));
Expand All @@ -200,6 +201,23 @@ private async Task DownloadInstallationFilesFromAzureStorageAccountCommandHandle
vm.AnalyzeAndUpdateStatesInBackgroundThread();

loggerComponentProvider.Log(LogLevel.Information, $"Downloaded installation file: {fileInfo.Name}");
if (vm.UnpackedZipFolderPath is not null)
{
handledUnpackedZipFolderPaths.Add(vm.UnpackedZipFolderPath);
}
}

foreach (var vm in ComponentProviders)
{
if (vm.UnpackedZipFolderPath is null ||
handledUnpackedZipFolderPaths.Contains(vm.UnpackedZipFolderPath, StringComparer.Ordinal) ||
DirectoryHelper.ExistsAndContainsFiles(vm.UnpackedZipFolderPath))
{
continue;
}

vm.PrepareInstallationFiles(unpackIfExist: true);
vm.AnalyzeAndUpdateStatesInBackgroundThread();
}

loggerComponentProvider.Log(LogLevel.Trace, "Downloaded installation files from Azure StorageAccount");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Atc.Wpf" Version="2.0.285" />
<PackageReference Include="Atc.Wpf.Controls" Version="2.0.285" />
<PackageReference Include="Atc.Wpf.FontIcons" Version="2.0.285" />
<PackageReference Include="Atc.Wpf.Theming" Version="2.0.285" />
<PackageReference Include="Atc.Wpf" Version="2.0.290" />
<PackageReference Include="Atc.Wpf.Controls" Version="2.0.290" />
<PackageReference Include="Atc.Wpf.FontIcons" Version="2.0.290" />
<PackageReference Include="Atc.Wpf.Theming" Version="2.0.290" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Atc.Wpf" Version="2.0.285" />
<PackageReference Include="Atc.Wpf.Controls" Version="2.0.285" />
<PackageReference Include="Atc.Wpf.FontIcons" Version="2.0.285" />
<PackageReference Include="Atc.Wpf.Theming" Version="2.0.285" />
<PackageReference Include="Atc.Wpf" Version="2.0.290" />
<PackageReference Include="Atc.Wpf.Controls" Version="2.0.290" />
<PackageReference Include="Atc.Wpf.FontIcons" Version="2.0.290" />
<PackageReference Include="Atc.Wpf.Theming" Version="2.0.290" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:atc="https://github.com/atc-net/atc-wpf/tree/main/schemas"
xmlns:atcValueConverters="https://github.com/atc-net/atc-wpf/tree/main/schemas/value-converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Atc.Installer.Wpf.ComponentProvider.InternetInformationServer"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Expand All @@ -15,25 +16,36 @@
<UserControl.Resources>
<valueConverters:X509CertificateNameValueConverter x:Key="X509CertificateNameValueConverter" />
<valueConverters:X509CertificateDnsNameValueConverter x:Key="X509CertificateDnsNameValueConverter" />
<valueConverters:X509CertificateValidationBrushValueConverter x:Key="X509CertificateValidationBrushValueConverter" />
<valueConverters:X509CertificateValidationInvalidToVisibilityVisibleValueConverter x:Key="X509CertificateValidationInvalidToVisibilityVisibleValueConverter" />
<atcValueConverters:ObjectNullToVisibilityCollapsedValueConverter x:Key="ObjectNullToVisibilityCollapsedValueConverter" />
</UserControl.Resources>

<GroupBox
Padding="5"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Background="{Binding Path=X509Certificate, Converter={StaticResource X509CertificateValidationBrushValueConverter}}"
Header="X509 Certificate">
<atc:UniformSpacingPanel Orientation="Vertical" Spacing="10">
<atc:UniformSpacingPanel Orientation="Vertical" Spacing="10">
<StackPanel Orientation="Vertical">

<atc:LabelTextInfo
HideAreas="InformationAndValidation"
LabelText="Name"
Orientation="Vertical"
Text="{Binding Path=X509Certificate, Converter={StaticResource X509CertificateNameValueConverter}}">
<atc:LabelTextInfo.ToolTip>
<Grid Background="{Binding Path=X509Certificate, Converter={StaticResource X509CertificateValidationBrushValueConverter}}">
<atc:UniformSpacingPanel
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Horizontal"
Spacing="10"
Visibility="{Binding Path=X509Certificate, Converter={StaticResource ObjectNullToVisibilityCollapsedValueConverter}}">
<TextBlock
HorizontalAlignment="Right"
Foreground="Red"
Text="Invalid certificate"
Visibility="{Binding Path=X509Certificate, Converter={StaticResource X509CertificateValidationInvalidToVisibilityVisibleValueConverter}}" />
<atc:SvgImage
Width="20"
Height="20"
ControlSizeType="ContentToSizeNoStretch"
OverrideColor="DodgerBlue"
Source="/Atc.Installer.Wpf.ComponentProvider;component/Resources/info_help.svg">
<atc:SvgImage.ToolTip>
<Grid>
<atc:UniformSpacingPanel
Margin="10"
Orientation="Vertical"
Expand Down Expand Up @@ -76,16 +88,25 @@
Text="{Binding Path=X509Certificate.Thumbprint, FallbackValue='N/A'}" />
</atc:UniformSpacingPanel>
</Grid>
</atc:LabelTextInfo.ToolTip>
</atc:LabelTextInfo>
</atc:SvgImage.ToolTip>
</atc:SvgImage>
</atc:UniformSpacingPanel>

<atc:UniformSpacingPanel Orientation="Vertical" Spacing="10">

<atc:LabelTextInfo
HideAreas="InformationAndValidation"
LabelText="Name"
Orientation="Vertical"
Text="{Binding Path=X509Certificate, Converter={StaticResource X509CertificateNameValueConverter}}" />

<Grid>
<atc:UniformSpacingPanel
HorizontalAlignment="Center"
IsEnabled="{Binding Path=EnableEditingMode}"
Spacing="10">
<Button
Width="80"
Width="70"
Background="Transparent"
BorderBrush="Transparent"
BorderThickness="0"
Expand All @@ -103,7 +124,7 @@
</StackPanel>
</Button>
<Button
Width="80"
Width="70"
Background="Transparent"
BorderBrush="Transparent"
BorderThickness="0"
Expand All @@ -124,6 +145,7 @@
</Grid>

</atc:UniformSpacingPanel>
</atc:UniformSpacingPanel>

</StackPanel>
</GroupBox>
</UserControl>
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// ReSharper disable InvertIf
namespace Atc.Installer.Wpf.ComponentProvider.InternetInformationServer.ValueConverters;

public class X509CertificateValidationBrushValueConverter : IValueConverter
public class X509CertificateValidationInvalidToVisibilityVisibleValueConverter : IValueConverter
{
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is X509Certificate2 certificate)
{
return certificate.IsValid()
? Brushes.Transparent
: Brushes.Red;
? Visibility.Hidden
: Visibility.Visible;
}

return Brushes.Transparent;
return Visibility.Hidden;
}

public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Atc.Wpf" Version="2.0.285" />
<PackageReference Include="Atc.Wpf.Controls" Version="2.0.285" />
<PackageReference Include="Atc.Wpf.FontIcons" Version="2.0.285" />
<PackageReference Include="Atc.Wpf.Theming" Version="2.0.285" />
<PackageReference Include="Atc.Wpf" Version="2.0.290" />
<PackageReference Include="Atc.Wpf.Controls" Version="2.0.290" />
<PackageReference Include="Atc.Wpf.FontIcons" Version="2.0.290" />
<PackageReference Include="Atc.Wpf.Theming" Version="2.0.290" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Atc.Wpf" Version="2.0.285" />
<PackageReference Include="Atc.Wpf.Controls" Version="2.0.285" />
<PackageReference Include="Atc.Wpf.FontIcons" Version="2.0.285" />
<PackageReference Include="Atc.Wpf.Theming" Version="2.0.285" />
<PackageReference Include="Atc.Wpf" Version="2.0.290" />
<PackageReference Include="Atc.Wpf.Controls" Version="2.0.290" />
<PackageReference Include="Atc.Wpf.FontIcons" Version="2.0.290" />
<PackageReference Include="Atc.Wpf.Theming" Version="2.0.290" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit c060214

Please sign in to comment.