Skip to content
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
8 changes: 1 addition & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
[*.cs]

# IDE0016: throw-Ausdruck verwenden
csharp_style_throw_expression = false:suggestion

# IDE0057: Bereichsoperator verwenden
csharp_style_prefer_range_operator = false:suggestion
[*.cs]
14 changes: 7 additions & 7 deletions .github/workflows/build_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

# version can be found here https://dotnet.microsoft.com/en-us/download/dotnet/9.0
# version can be found here https://dotnet.microsoft.com/en-us/download/dotnet/10.0
- name: Setup .NET
uses: actions/setup-dotnet@v4
uses: actions/setup-dotnet@v5
with:
dotnet-version: 9.0.x
dotnet-version: 10.0.x

- name: Install wasm-tools
run: dotnet workload install wasm-tools-net9
run: dotnet workload install wasm-tools

- name: Build release
run: dotnet publish AudioCuesheetEditor --configuration Release --output release

- name: Upload Build Artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: AudioCuesheetEditor-Release
path: ./release
Expand All @@ -45,7 +45,7 @@ jobs:
}}
steps:
- name: Download Build Artifact
uses: actions/download-artifact@v4
uses: actions/download-artifact@v7
with:
name: AudioCuesheetEditor-Release
- name: Deploy to Netlify
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/checkout@v6

- name: Set timestamp variable
id: timestamp
run: echo "datetime=$(date +'%Y-%m-%d_%H-%M-%S')" >> $GITHUB_OUTPUT

# version can be found here https://dotnet.microsoft.com/en-us/download/dotnet/9.0
# version can be found here https://dotnet.microsoft.com/en-us/download/dotnet/10.0
- name: Setup .NET
uses: actions/setup-dotnet@v4
uses: actions/setup-dotnet@v5
with:
dotnet-version: 9.0.x
dotnet-version: 10.0.x

- name: Install wasm-tools
run: dotnet workload install wasm-tools-net9
run: dotnet workload install wasm-tools

- name: Build & Install
run: dotnet build
- name: Ensure browsers are installed
run: pwsh AudioCuesheetEditor.End2EndTests/bin/Debug/net9.0/playwright.ps1 install --with-deps
run: pwsh AudioCuesheetEditor.End2EndTests/bin/Debug/net10.0/playwright.ps1 install --with-deps

- name: Start App
run: dotnet run --project AudioCuesheetEditor &
Expand Down Expand Up @@ -59,8 +59,8 @@ jobs:

- name: Upload traces
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: playwright-traces-${{ steps.timestamp.outputs.datetime }}
path: AudioCuesheetEditor.End2EndTests/bin/Debug/net9.0/playwright-traces/
path: AudioCuesheetEditor.End2EndTests/bin/Debug/net10.0/playwright-traces/
if-no-files-found: ignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down
2 changes: 1 addition & 1 deletion AudioCuesheetEditor.End2EndTests/MSTestSettings.cs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[assembly: Parallelize(Scope = ExecutionScope.MethodLevel)]
[assembly: Parallelize()]
18 changes: 7 additions & 11 deletions AudioCuesheetEditor.End2EndTests/Models/AppBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,32 @@

namespace AudioCuesheetEditor.End2EndTests.Models
{
partial class AppBar
partial class AppBar(IPage page)
{
[GeneratedRegex("^Open$")]
private static partial Regex OpenRegex();

private readonly IPage _page;
private readonly ILocator _menuButton;
private readonly IPage _page = page;
internal ILocator MenuButton => _page.GetByRole(AriaRole.Toolbar).GetByRole(AriaRole.Button, new() { Name = "More" });

internal ILocator UndoButton => _page.GetByRole(AriaRole.Button, new() { Name = "undo" });

internal ILocator RedoButton => _page.GetByRole(AriaRole.Button, new() { Name = "redo" });

internal ILocator HomeButton => _page.Locator(".mud-button-root").First;

internal AppBar(IPage page)
{
_page = page;
_menuButton = _page.GetByRole(AriaRole.Button, new() { Name = "More" });
}

internal async Task OpenSettingsAsync()
{
await _menuButton.ClickAsync();
await MenuButton.ClickAsync();
await _page.GetByText("Settings").ClickAsync();
}

internal async Task ChangeLanguageAsync(string language)
{
await _page.GetByRole(AriaRole.Button, new() { Name = "Change language" }).ClickAsync();
await _page.GetByText(language).ClickAsync();
await _page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await _page.WaitForFunctionAsync(@"() => window.Blazor !== undefined");
}

internal async Task UndoAsync()
Expand Down Expand Up @@ -81,7 +77,7 @@ internal async Task OpenExportDialogAsync(string exportType, string fileMenuName

internal async Task OpenDisplayHotkeysAsync()
{
await _page.GetByRole(AriaRole.Button, new() { Name = "More" }).ClickAsync();
await MenuButton.ClickAsync();
await _page.GetByText("Hotkeys").ClickAsync();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public async Task DownloadText_GeneratesTextFile_WhenCuesheetIsValidAsync()
await detailView.AudiofileInput.SetInputFilesAsync("Kalimba.mp3");
await detailView.EditTrackAsync("Track Artist 1", "Track Title 1");
await bar.OpenExportDialogAsync("Textfile");
await TestPage.GetByRole(AriaRole.Button, new() { Name = "Next" }).ClickAsync();
await TestPage.GetByRole(AriaRole.Button, new() { Name = "Next", Exact = true }).ClickAsync();
var downloadTask = TestPage.WaitForDownloadAsync();
await TestPage.GetByRole(AriaRole.Button, new() { Name = "Download-YouTube.txt" }).ClickAsync();
var download = await downloadTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public async Task DownloadText_GeneratesTextFile_WhenCuesheetIsValidAsync()
await detailView.AudiofileInput.SetInputFilesAsync("Kalimba.mp3");
await detailView.EditTrackAsync("Track Artist 1", "Track Title 1");
await bar.OpenExportDialogAsync("Textfile");
await TestPage.GetByRole(AriaRole.Button, new() { Name = "Next" }).ClickAsync();
await TestPage.GetByRole(AriaRole.Button, new() { Name = "Next", Exact = true }).ClickAsync();
var downloadTask = TestPage.WaitForDownloadAsync();
await TestPage.GetByRole(AriaRole.Button, new() { Name = "Download-YouTube.txt" }).ClickAsync();
var download = await downloadTask;
Expand Down
4 changes: 2 additions & 2 deletions AudioCuesheetEditor.Tests/AudioCuesheetEditor.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<EnableMSTestRunner>true</EnableMSTestRunner>
<OutputType>Exe</OutputType>
Expand Down
14 changes: 7 additions & 7 deletions AudioCuesheetEditor/AudioCuesheetEditor.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<PackageProjectUrl>https://github.com/NeoCoderMatrix86/AudioCuesheetEditor</PackageProjectUrl>
<RazorLangVersion>3.0</RazorLangVersion>
<Version>10.4.0</Version>
<Version>11.0.0</Version>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<PublishTrimmed>true</PublishTrimmed>
<RunAOTCompilation>true</RunAOTCompilation>
Expand All @@ -22,13 +22,13 @@
<ItemGroup>
<PackageReference Include="HtmlSanitizer" Version="9.0.892" />
<PackageReference Include="MetaBrainz.MusicBrainz" Version="8.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.13" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.13" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.3" PrivateAssets="all" />
<PackageReference Include="BlazorDownloadFile" Version="2.4.0.2" />
<PackageReference Include="Howler.Blazor" Version="0.10.0" />
<PackageReference Include="Markdig" Version="0.45.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.13" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="9.0.13" />
<PackageReference Include="Markdig" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="10.0.3" />
<PackageReference Include="MudBlazor" Version="8.15.0" />
<PackageReference Include="Toolbelt.Blazor.HotKeys2" Version="6.2.0" />
<PackageReference Include="z440.atl.core" Version="7.11.0" />
Expand Down
2 changes: 1 addition & 1 deletion AudioCuesheetEditor/Model/AudioCuesheet/Track.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public Track() { }
/// Create object with copied values from input
/// </summary>
/// <param name="track">Object to copy values from</param>
/// /// <param name="copyCuesheetReference">Copy cuesheet reference from track also?</param>
/// <param name="copyCuesheetReference">Copy cuesheet reference from track also?</param>
public Track(ITrack track, Boolean copyCuesheetReference = true) : this()
{
CopyValues(track, copyCuesheetReference);
Expand Down
25 changes: 1 addition & 24 deletions AudioCuesheetEditor/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using MudBlazor.Services;
using System.Globalization;
using System.Reflection;
using Toolbelt.Blazor.Extensions.DependencyInjection;

var builder = WebAssemblyHostBuilder.CreateDefault(args);
Expand Down Expand Up @@ -73,29 +71,8 @@

builder.Services.AddHotKeys2();

// TODO: Remove this when https://github.com/dotnet/aspnetcore/issues/56824 is fixed

// Get current localization culture
var currentCulture = CultureInfo.DefaultThreadCurrentCulture;

// Get WASM culture provider via reflection
var type = Assembly.GetAssembly(typeof(WebAssemblyHost))!.GetType("Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyCultureProvider");
var instance = type
!.GetProperty("Instance", BindingFlags.Public | BindingFlags.Static)
?.GetValue(null);

// Swap out the "current culture" for the UI (localization) culture
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("de-DE");
// Load the satellite assemblies
await (ValueTask)instance!
.GetType()
.GetMethod("LoadCurrentCultureResourcesAsync", BindingFlags.Public | BindingFlags.Instance)!
.Invoke(instance, [])!;
// Swap the culture back
CultureInfo.DefaultThreadCurrentCulture = currentCulture;

var host = builder.Build();

await host.SetCultureFromConfigurationAsync();

await host.RunAsync();
await host.RunAsync();
15 changes: 12 additions & 3 deletions AudioCuesheetEditor/Services/IO/FileInputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using AudioCuesheetEditor.Model.IO;
using AudioCuesheetEditor.Model.IO.Audio;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.WebAssembly.Http;
using Microsoft.JSInterop;

namespace AudioCuesheetEditor.Services.IO
Expand Down Expand Up @@ -54,15 +55,18 @@ public bool IsValidAudiofile(IBrowserFile browserFile)

public Boolean CheckFileMimeType(IBrowserFile file, String mimeType, IEnumerable<String> fileExtensions)
{
_logger.LogDebug("CheckFileMimeType called with file: file.Name: '{FileName}', file.ContentType: '{ContentType}', mimeType: '{MimeType}', fileExtensions: '{fileExtensions}'", file.Name, file.ContentType, mimeType, fileExtensions);
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug("CheckFileMimeType called with file: file.Name: '{FileName}', file.ContentType: '{ContentType}', mimeType: '{MimeType}', fileExtensions: '{fileExtensions}'", file.Name, file.ContentType, mimeType, fileExtensions);
}
Boolean fileMimeTypeMatches = false;
if ((file != null) && (String.IsNullOrEmpty(mimeType) == false))
{
if (String.IsNullOrEmpty(file.ContentType) == false)
{
if (mimeType.EndsWith("/*"))
{
var mainType = mimeType.Substring(0, mimeType.Length - 1);
var mainType = mimeType[..^1];
fileMimeTypeMatches = file.ContentType.StartsWith(mainType, StringComparison.CurrentCultureIgnoreCase);
}
else
Expand Down Expand Up @@ -93,7 +97,12 @@ public Boolean CheckFileMimeType(IBrowserFile file, String mimeType, IEnumerable
audiofile = new Audiofile(browserFile.Name, audioFileObjectURL, codec);
if (String.IsNullOrEmpty(audioFileObjectURL) == false)
{
var loadContentStreamTask = _httpClient.GetStreamAsync(audioFileObjectURL)
var request = new HttpRequestMessage(HttpMethod.Get, audioFileObjectURL);
//TODO: Enable when https://github.com/NeoCoderMatrix86/AudioCuesheetEditor/issues/524 gets done
request.SetBrowserRequestStreamingEnabled(false);

var response = await _httpClient.SendAsync(request);
var loadContentStreamTask = response.Content.ReadAsStreamAsync()
.ContinueWith(x => audiofile.ContentStream = x.Result);
if (afterContentStreamLoaded != null)
{
Expand Down
20 changes: 16 additions & 4 deletions AudioCuesheetEditor/Services/IO/ImportManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ public void ImportData(String? data)
FileType = ImportFileType.Textfile
};
stopwatch.Stop();
_logger.LogDebug("ImportData duration: {stopwatch.Elapsed}", stopwatch.Elapsed);
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug("ImportData duration: {stopwatch.Elapsed}", stopwatch.Elapsed);
}
}

public async Task AnalyseImportfile()
Expand Down Expand Up @@ -94,7 +97,10 @@ public async Task AnalyseImportfile()
}
}
stopwatch.Stop();
_logger.LogDebug("ImportTextAsync duration: {stopwatch.Elapsed}", stopwatch.Elapsed);
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug("ImportTextAsync duration: {stopwatch.Elapsed}", stopwatch.Elapsed);
}
}

public void ImportCuesheet()
Expand All @@ -109,7 +115,10 @@ public void ImportCuesheet()
}
_sessionStateContainer.ResetImport();
stopwatch.Stop();
_logger.LogDebug("ImportCuesheet duration: {stopwatch.Elapsed}", stopwatch.Elapsed);
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug("ImportCuesheet duration: {stopwatch.Elapsed}", stopwatch.Elapsed);
}
}

public async Task UploadFilesAsync(IEnumerable<IBrowserFile> files, String? fileInputId = null)
Expand Down Expand Up @@ -175,7 +184,10 @@ public async Task UploadFilesAsync(IEnumerable<IBrowserFile> files, String? file
}
UploadFilesFinished?.Invoke(this, invalidFiles);
stopwatch.Stop();
_logger.LogDebug("UploadFilesAsync duration: {stopwatch.Elapsed}", stopwatch.Elapsed);
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug("UploadFilesAsync duration: {stopwatch.Elapsed}", stopwatch.Elapsed);
}
}

private static async Task<MemoryStream> ReadFileContentAsync(IBrowserFile file)
Expand Down
Loading