diff --git a/AudioCuesheetEditor/AudioCuesheetEditor.csproj b/AudioCuesheetEditor/AudioCuesheetEditor.csproj
index 7fbf0ec5..9a9dc7f8 100644
--- a/AudioCuesheetEditor/AudioCuesheetEditor.csproj
+++ b/AudioCuesheetEditor/AudioCuesheetEditor.csproj
@@ -7,7 +7,7 @@
enable
https://github.com/NeoCoderMatrix86/AudioCuesheetEditor
3.0
- 6.0.0
+ 7.0.0
false
true
true
@@ -53,6 +53,8 @@
+
+
@@ -98,6 +100,8 @@
+
+
@@ -110,20 +114,20 @@
-
-
+
+
-
-
+
+
-
+
-
+
diff --git a/AudioCuesheetEditor/Data/Options/ILocalStorageOptionsProvider.cs b/AudioCuesheetEditor/Data/Options/ILocalStorageOptionsProvider.cs
new file mode 100644
index 00000000..938d0b4c
--- /dev/null
+++ b/AudioCuesheetEditor/Data/Options/ILocalStorageOptionsProvider.cs
@@ -0,0 +1,28 @@
+//This file is part of AudioCuesheetEditor.
+
+//AudioCuesheetEditor is free software: you can redistribute it and/or modify
+//it under the terms of the GNU General Public License as published by
+//the Free Software Foundation, either version 3 of the License, or
+//(at your option) any later version.
+
+//AudioCuesheetEditor is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//GNU General Public License for more details.
+
+//You should have received a copy of the GNU General Public License
+//along with Foobar. If not, see
+//.
+using AudioCuesheetEditor.Model.Options;
+using System.Linq.Expressions;
+
+namespace AudioCuesheetEditor.Data.Options
+{
+ public interface ILocalStorageOptionsProvider
+ {
+ event EventHandler? OptionSaved;
+ Task GetOptions() where T : IOptions;
+ Task SaveOptions(IOptions options);
+ Task SaveOptionsValue(Expression> propertyExpression, object value) where T : class, IOptions, new();
+ }
+}
diff --git a/AudioCuesheetEditor/Data/Options/LocalStorageOptionsProvider.cs b/AudioCuesheetEditor/Data/Options/LocalStorageOptionsProvider.cs
index 62cd9f52..743a4cf1 100644
--- a/AudioCuesheetEditor/Data/Options/LocalStorageOptionsProvider.cs
+++ b/AudioCuesheetEditor/Data/Options/LocalStorageOptionsProvider.cs
@@ -22,7 +22,7 @@
namespace AudioCuesheetEditor.Data.Options
{
- public class LocalStorageOptionsProvider(IJSRuntime jsRuntime)
+ public class LocalStorageOptionsProvider(IJSRuntime jsRuntime): ILocalStorageOptionsProvider
{
public event EventHandler? OptionSaved;
diff --git a/AudioCuesheetEditor/Extensions/SessionStateContainer.cs b/AudioCuesheetEditor/Extensions/SessionStateContainer.cs
index cbc900d4..1a988975 100644
--- a/AudioCuesheetEditor/Extensions/SessionStateContainer.cs
+++ b/AudioCuesheetEditor/Extensions/SessionStateContainer.cs
@@ -31,8 +31,6 @@ public class SessionStateContainer
private ViewMode currentViewMode;
private Cuesheet cuesheet;
private Cuesheet? importCuesheet;
- private TextImportfile? textImportFile;
- private CuesheetImportfile? cuesheetImportFile;
private Audiofile? importAudiofile;
public SessionStateContainer(TraceChangeManager traceChangeManager)
@@ -65,50 +63,6 @@ public Cuesheet? ImportCuesheet
}
}
- public TextImportfile? TextImportFile
- {
- get { return textImportFile; }
- set
- {
- if (textImportFile != null)
- {
- textImportFile.AnalysisFinished -= TextImportScheme_AnalysisFinished;
- }
- textImportFile = value;
- if (textImportFile != null)
- {
- textImportFile.AnalysisFinished += TextImportScheme_AnalysisFinished;
- ImportCuesheet = textImportFile.Cuesheet;
- }
- else
- {
- ImportCuesheet = null;
- }
- }
- }
-
- public CuesheetImportfile? CuesheetImportFile
- {
- get { return cuesheetImportFile; }
- set
- {
- if (cuesheetImportFile != null)
- {
- cuesheetImportFile.AnalysisFinished -= CuesheetImportFile_AnalysisFinished;
- }
- cuesheetImportFile = value;
- if ((CuesheetImportFile != null) && (CuesheetImportFile.Cuesheet != null))
- {
- CuesheetImportFile.AnalysisFinished += CuesheetImportFile_AnalysisFinished;
- ImportCuesheet = CuesheetImportFile.Cuesheet;
- }
- else
- {
- ImportCuesheet = null;
- }
- }
- }
-
public Audiofile? ImportAudiofile
{
get => importAudiofile;
@@ -133,74 +87,26 @@ public ViewMode CurrentViewMode
}
}
- public IImportfile? Importfile
- {
- get
- {
- if (TextImportFile != null)
- {
- return TextImportFile;
- }
- if (CuesheetImportFile != null)
- {
- return CuesheetImportFile;
- }
- return null;
- }
- }
+ public IImportfile? Importfile{ get; set; }
public void ResetImport()
{
- TextImportFile = null;
- CuesheetImportFile = null;
+ Importfile = null;
ImportAudiofile = null;
- }
-
- public void StartImportCuesheet(ApplicationOptions applicationOptions)
- {
- if (ImportCuesheet != null)
- {
- Cuesheet.Import(ImportCuesheet, applicationOptions, _traceChangeManager);
- ImportCuesheet = null;
- }
- ResetImport();
+ ImportCuesheet = null;
}
private void SetCuesheetReference(Cuesheet value)
{
- cuesheet.CuesheetImported -= Cuesheet_CuesheetImported;
cuesheet = value;
- cuesheet.CuesheetImported += Cuesheet_CuesheetImported;
_traceChangeManager.Reset();
_traceChangeManager.TraceChanges(Cuesheet);
CuesheetChanged?.Invoke(this, EventArgs.Empty);
}
- private void TextImportScheme_AnalysisFinished(object? sender, EventArgs eventArgs)
- {
- if (textImportFile != null)
- {
- ImportCuesheet = textImportFile.Cuesheet;
- }
- else
- {
- ImportCuesheet = null;
- }
- }
- private void Cuesheet_CuesheetImported(object? sender, EventArgs e)
+
+ public void FireCuesheetImported()
{
CuesheetChanged?.Invoke(this, EventArgs.Empty);
}
-
- void CuesheetImportFile_AnalysisFinished(object? sender, EventArgs e)
- {
- if (CuesheetImportFile != null)
- {
- ImportCuesheet = CuesheetImportFile.Cuesheet;
- }
- else
- {
- ImportCuesheet = null;
- }
- }
}
}
diff --git a/AudioCuesheetEditor/Extensions/WebAssemblyHostExtension.cs b/AudioCuesheetEditor/Extensions/WebAssemblyHostExtension.cs
index 0c68e392..bdba0ae4 100644
--- a/AudioCuesheetEditor/Extensions/WebAssemblyHostExtension.cs
+++ b/AudioCuesheetEditor/Extensions/WebAssemblyHostExtension.cs
@@ -24,7 +24,7 @@ public static class WebAssemblyHostExtension
{
public async static Task SetDefaultCulture(this WebAssemblyHost host)
{
- var localStorageOptionsProvider = host.Services.GetRequiredService();
+ var localStorageOptionsProvider = host.Services.GetRequiredService();
var options = await localStorageOptionsProvider.GetOptions();
CultureInfo.DefaultThreadCurrentCulture = options.Culture;
diff --git a/AudioCuesheetEditor/Model/AudioCuesheet/CatalogueNumber.cs b/AudioCuesheetEditor/Model/AudioCuesheet/CatalogueNumber.cs
index fa38b21f..41c35d76 100644
--- a/AudioCuesheetEditor/Model/AudioCuesheet/CatalogueNumber.cs
+++ b/AudioCuesheetEditor/Model/AudioCuesheet/CatalogueNumber.cs
@@ -46,12 +46,12 @@ protected override ValidationResult Validate(string property)
validationStatus = ValidationStatus.Success;
if (Value.All(Char.IsDigit) == false)
{
- validationMessages ??= new();
+ validationMessages ??= [];
validationMessages.Add(new ValidationMessage("{0} must only contain numbers!", nameof(Value)));
}
if (Value.Length != 13)
{
- validationMessages ??= new();
+ validationMessages ??= [];
validationMessages.Add(new ValidationMessage("{0} has an invalid length. Allowed length is {1}!", nameof(Value), 13));
}
}
diff --git a/AudioCuesheetEditor/Model/AudioCuesheet/Cuesheet.cs b/AudioCuesheetEditor/Model/AudioCuesheet/Cuesheet.cs
index 4b17102c..755f4d14 100644
--- a/AudioCuesheetEditor/Model/AudioCuesheet/Cuesheet.cs
+++ b/AudioCuesheetEditor/Model/AudioCuesheet/Cuesheet.cs
@@ -14,7 +14,6 @@
//along with Foobar. If not, see
//.
using AudioCuesheetEditor.Model.Entity;
-using AudioCuesheetEditor.Model.IO;
using AudioCuesheetEditor.Model.IO.Audio;
using AudioCuesheetEditor.Model.IO.Export;
using AudioCuesheetEditor.Model.Options;
@@ -39,11 +38,8 @@ public class CuesheetSectionAddRemoveEventArgs(CuesheetSection section) : EventA
public CuesheetSection Section { get; } = section;
}
- public class Cuesheet(TraceChangeManager? traceChangeManager = null) : Validateable, ICuesheetEntity, ITraceable
+ public class Cuesheet(TraceChangeManager? traceChangeManager = null) : Validateable, ITraceable, ICuesheet
{
- public const String MimeType = "text/*";
- public const String FileExtension = ".cue";
-
private readonly object syncLock = new();
private List