Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native AOT #4

Merged
merged 12 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,19 @@ jobs:
uses: microsoft/setup-msbuild@main
with:
msbuild-architecture: x64
- name: Setup .NET 8
- name: Setup .NET 9
uses: actions/setup-dotnet@main
with:
dotnet-version: 8.x
dotnet-version: 9.x
dotnet-quality: 'preview'
- name: Setup Windows 11 SDK (10.0.22621.0)
uses: GuillaumeFalourd/setup-windows10-sdk-action@main
with:
sdk-version: 22621
- name: Restore
run: msbuild SUBSTitute.sln /t:restore
run: dotnet restore SUBSTitute.sln
- name: Build
run: msbuild SUBSTitute.sln /p:Configuration=${{ github.event_name != 'workflow_dispatch' && 'Debug' || inputs.build_configuration }} /p:VersionSuffix=ci /p:RestorePackages=false
run: dotnet build SUBSTitute.sln --configuration ${{ github.event_name != 'workflow_dispatch' && 'Debug' || inputs.build_configuration }} --no-restore -p:VersionSuffix=ci
sonarcloud:
name: SonarCloud
runs-on: windows-latest
Expand All @@ -66,10 +67,11 @@ jobs:
uses: actions/checkout@main
with:
fetch-depth: 0
- name: Setup .NET 8
- name: Setup .NET 9
uses: actions/setup-dotnet@main
with:
dotnet-version: 8.x
dotnet-version: 9.x
dotnet-quality: 'preview'
- name: Setup Windows 11 SDK (10.0.22621.0)
uses: GuillaumeFalourd/setup-windows10-sdk-action@main
with:
Expand Down Expand Up @@ -109,5 +111,5 @@ jobs:
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"sungaila_SUBSTitute" /o:"sungaila" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
dotnet restore SUBSTitute.sln
dotnet build SUBSTitute.sln --configuration ${{ github.event_name != 'workflow_dispatch' && 'Debug' || inputs.build_configuration }} --no-restore
dotnet build SUBSTitute.sln --configuration ${{ github.event_name != 'workflow_dispatch' && 'Debug' || inputs.build_configuration }} --no-restore
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@
# SUBSTitute
A GUI for mapping directories to virtual drives (see *SUBST* command). It is built on top of **.NET 8.0** and **Windows UI Library 3 (WinUI 3)**.

<img src="https://raw.githubusercontent.com/sungaila/SUBSTitute/master/etc/screenshot5_en-us.png" width="800" alt="Screenshot from version 2.0.0">
<img src="https://raw.githubusercontent.com/sungaila/SUBSTitute/master/etc/screenshot5_en-us.png" width="800" alt="Screenshot from version 2.1.1">
<span style="white-space:nowrap">
<img src="https://raw.githubusercontent.com/sungaila/SUBSTitute/master/etc/screenshot1_en-us.png" width="200" alt="Screenshot from version 2.1.1">
<img src="https://raw.githubusercontent.com/sungaila/SUBSTitute/master/etc/screenshot2_en-us.png" width="200" alt="Screenshot from version 2.1.1">
<img src="https://raw.githubusercontent.com/sungaila/SUBSTitute/master/etc/screenshot3_en-us.png" width="200" alt="Screenshot from version 2.1.1">
<img src="https://raw.githubusercontent.com/sungaila/SUBSTitute/master/etc/screenshot4_en-us.png" width="200" alt="Screenshot from version 2.1.1">
</span>
<br>
<a href="https://apps.microsoft.com/detail/9NGPRNJJKLBG?launch=true">
<img alt="Get it from Microsoft Store" src="https://get.microsoft.com/images/en-us%20dark.svg" width="200"/>
<img alt="Get it from Microsoft Store" src="https://get.microsoft.com/images/en-us%20dark.svg" width="200"/
</a>
Binary file modified etc/screenshot1_de-de.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified etc/screenshot1_en-us.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified etc/screenshot2_de-de.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified etc/screenshot2_en-us.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified etc/screenshot3_de-de.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified etc/screenshot3_en-us.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified etc/screenshot4_de-de.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified etc/screenshot4_en-us.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified etc/screenshot5_de-de.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified etc/screenshot5_en-us.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="CommunityToolkit Main" value="https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-MainLatest/nuget/v3/index.json" />
<add key="CommunityToolkit Labs" value="https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json" />
</packageSources>
</configuration>
2 changes: 1 addition & 1 deletion src/App.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity type="win32"
name="Sungaila.SUBSTitute"
version="2.1.0.0" />
version="2.1.1.0" />

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
Expand Down
1 change: 1 addition & 0 deletions src/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<ResourceDictionary Source="ThirdParty/DataTable/DataColumn.xaml" />
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/AddDriveCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static class AddDriveCommands
parameter.SelectedLetter = parameter.AvailableLetters.FirstOrDefault();
});

public static readonly IRelayCommand<AddDriveViewModel> AddVirtualDrive = new AsyncRelayCommand<AddDriveViewModel>(async parameter =>
public static readonly IRelayCommand<AddDriveViewModel> AddVirtualDrive = new RelayCommand<AddDriveViewModel>(parameter =>
{
parameter!.CancelClose = false;

Expand All @@ -55,7 +55,7 @@ public static class AddDriveCommands

var selectedPath = Path.GetFullPath(parameter.SelectedPath.Trim('\"'));

_ = await StorageFolder.GetFolderFromPathAsync(selectedPath);
_ = StorageFolder.GetFolderFromPathAsync(selectedPath).GetAwaiter().GetResult();

if (parameter.IsPermanent)
{
Expand Down
30 changes: 19 additions & 11 deletions src/Commands/MappingCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,29 @@ internal static DriveViewModel GetDriveViewModel(MappingViewModel mappingViewMod

Task.Run(async () =>
{
// get the disk label and file system
string? driveName = null;
string? driveFormat = null;

try
{
var folder = await StorageFolder.GetFolderFromPathAsync(driveInfo.Name);
var properties = await folder.GetBasicPropertiesAsync();
var prop = await properties.RetrievePropertiesAsync(["System.Volume.FileSystem"]);
var filesystem = prop.First().Value as string;

App.MainWindow?.DispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, () =>
{
result.Label = folder.DisplayName;
result.DriveFormat = filesystem ?? string.Empty;
});
driveName = (await StorageFolder.GetFolderFromPathAsync(driveInfo.Name)).DisplayName;
}
catch { }

try
{
driveFormat = driveInfo.DriveFormat;
}
catch (IOException ex) when (ex.HResult == -2147024875)
{
// ERROR_NOT_READY: Device not ready
}

App.MainWindow?.DispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, () =>
{
result.Label = driveName ?? string.Empty;
result.DriveFormat = driveFormat ?? string.Empty;
});
});

return result;
Expand Down
35 changes: 35 additions & 0 deletions src/Converters/ElementThemeToIntConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Data;
using System;

namespace Sungaila.SUBSTitute.Converters
{
public partial class ElementThemeToIntConverter : IValueConverter
{
public object? Convert(object value, Type targetType, object parameter, string language)
{
if (value is not ElementTheme theme)
return DependencyProperty.UnsetValue;

return theme switch
{
ElementTheme.Light => 0,
ElementTheme.Dark => 1,
_ => 2
};
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
{
if (value is not int selectedIndex)
return DependencyProperty.UnsetValue;

return selectedIndex switch
{
0 => ElementTheme.Light,
1 => ElementTheme.Dark,
_ => ElementTheme.Default
};
}
}
}
57 changes: 0 additions & 57 deletions src/Extensions/HackedCollectionView.Defer.cs

This file was deleted.

62 changes: 0 additions & 62 deletions src/Extensions/HackedCollectionView.Events.cs

This file was deleted.

Loading
Loading