diff --git a/AudioCuesheetEditor/Model/Entity/IValidateable.cs b/AudioCuesheetEditor/Model/Entity/IValidateable.cs index 324e6e77..eb779b5c 100644 --- a/AudioCuesheetEditor/Model/Entity/IValidateable.cs +++ b/AudioCuesheetEditor/Model/Entity/IValidateable.cs @@ -53,7 +53,7 @@ public class ValidationResult { private List? validationMessages; - public static ValidationResult Create(ValidationStatus validationStatus, IReadOnlyCollection? validationMessages = null) + public static ValidationResult Create(ValidationStatus validationStatus, IEnumerable? validationMessages = null) { return new ValidationResult() { Status = validationStatus, ValidationMessages = validationMessages?.ToList() }; } diff --git a/AudioCuesheetEditor/Model/IO/Export/ExportfileGenerator.cs b/AudioCuesheetEditor/Model/IO/Export/ExportfileGenerator.cs index 01db88a1..1d155901 100644 --- a/AudioCuesheetEditor/Model/IO/Export/ExportfileGenerator.cs +++ b/AudioCuesheetEditor/Model/IO/Export/ExportfileGenerator.cs @@ -30,62 +30,27 @@ public enum ExportType Exportprofile } - public class ExportfileGenerator + public class ExportfileGenerator : Validateable { public Cuesheet Cuesheet { get; } public Exportprofile? Exportprofile { get; set; } public ApplicationOptions? ApplicationOptions { get; set; } public IAudioConverterService? AudioConverterService { get; set; } + public ExportType ExportType { get; set; } - public ExportfileGenerator(Cuesheet cuesheet, Exportprofile? exportprofile = null, ApplicationOptions? applicationOptions = null, IAudioConverterService? audioConverterService = null) + public ExportfileGenerator(ExportType exportType, Cuesheet cuesheet, Exportprofile? exportprofile = null, ApplicationOptions? applicationOptions = null, IAudioConverterService? audioConverterService = null) { + ExportType = exportType; Cuesheet = cuesheet; Exportprofile = exportprofile; ApplicationOptions = applicationOptions; AudioConverterService = audioConverterService; } - /// - /// Is an export of the possible? - /// - /// Which type of export should be done? - /// Boolean indicating if export is possible or not - public Boolean CanWrite(ExportType exportType) - { - Boolean canWrite = false; - switch (exportType) - { - case ExportType.Cuesheet: - canWrite = (Cuesheet.Validate().Status != ValidationStatus.Error) - && (Cuesheet.Cataloguenumber.Validate().Status != ValidationStatus.Error) - && Cuesheet.Tracks.All(x => x.Validate().Status != ValidationStatus.Error) - && (ApplicationOptions?.Validate(x => x.CuesheetFilename).Status != ValidationStatus.Error); - break; - case ExportType.Exportprofile: - if (Exportprofile != null) - { - canWrite = (Cuesheet.Validate().Status != ValidationStatus.Error) - && (Cuesheet.Cataloguenumber.Validate().Status != ValidationStatus.Error) - && Cuesheet.Tracks.All(x => x.Validate().Status != ValidationStatus.Error) - && (ApplicationOptions?.Validate(x => x.CuesheetFilename).Status != ValidationStatus.Error) - && (Exportprofile.Validate().Status != ValidationStatus.Error); - } - break; - } - var hasSplitPoints = Cuesheet.SplitPoints.Any(); - if (hasSplitPoints) - { - canWrite = canWrite - && AudioConverterService != null - && Cuesheet.Audiofile != null; - } - return canWrite; - } - - public async Task> GenerateExportfilesAsync(ExportType exportType) + public async Task> GenerateExportfilesAsync() { List exportfiles = new(); - if (CanWrite(exportType)) + if (Validate().Status != ValidationStatus.Error) { if (Cuesheet.SplitPoints.Count != 0) { @@ -99,7 +64,7 @@ public async Task> GenerateExportfilesAsync(Expo audioFileName = String.Format("{0}({1}){2}", Path.GetFileNameWithoutExtension(Cuesheet.Audiofile?.Name), counter, Path.GetExtension(Cuesheet.Audiofile?.Name)); if (splitPoint.Validate().Status == ValidationStatus.Success) { - switch (exportType) + switch (ExportType) { case ExportType.Cuesheet: content = WriteCuesheet(audioFileName, previousSplitPointMoment, splitPoint); @@ -124,7 +89,7 @@ public async Task> GenerateExportfilesAsync(Expo } //After a split point attach the last part audioFileName = String.Format("{0}({1}){2}", Path.GetFileNameWithoutExtension(Cuesheet.Audiofile?.Name), counter, Path.GetExtension(Cuesheet.Audiofile?.Name)); - switch (exportType) + switch (ExportType) { case ExportType.Cuesheet: content = WriteCuesheet(audioFileName, previousSplitPointMoment); @@ -148,7 +113,7 @@ public async Task> GenerateExportfilesAsync(Expo { String filename = String.Empty; String? content = null; - switch (exportType) + switch (ExportType) { case ExportType.Cuesheet: var cuesheetfilename = ApplicationOptions?.CuesheetFilename; @@ -381,5 +346,100 @@ private String WriteExport(String audiofileName, TimeSpan? from = null, SplitPoi } return exportAudiofile; } + + protected override ValidationResult Validate(string property) + { + ValidationResult validationResult; + switch (property) + { + case nameof(Cuesheet): + var validationResults = new Dictionary + { + { Cuesheet, Cuesheet.Validate() }, + { Cuesheet.Cataloguenumber, Cuesheet.Cataloguenumber.Validate() } + }; + foreach (var track in Cuesheet.Tracks) + { + validationResults.Add(track, track.Validate()); + } + if (validationResults.Any(x => x.Value.Status == ValidationStatus.Error)) + { + var messages = validationResults.Values.Where(x => x.ValidationMessages != null).SelectMany(x => x.ValidationMessages!); + validationResult = ValidationResult.Create(ValidationStatus.Error, messages); + } + else + { + validationResult = ValidationResult.Create(ValidationStatus.Success); + } + break; + case nameof(ApplicationOptions): + if (ExportType == ExportType.Cuesheet) + { + if (ApplicationOptions == null) + { + var validationMessages = new List() + { + new("{0} has no value!", nameof(ApplicationOptions)) + }; + validationResult = ValidationResult.Create(ValidationStatus.Error, validationMessages); + } + else + { + validationResult = ValidationResult.Create(ValidationStatus.Success); + } + } + else + { + validationResult = ValidationResult.Create(ValidationStatus.NoValidation); + } + break; + case nameof(Exportprofile): + if (ExportType == ExportType.Exportprofile) + { + if (Exportprofile != null) + { + validationResult = Exportprofile.Validate(); + } + else + { + var validationMessages = new List() + { + new("{0} has no value!", nameof(Exportprofile)) + }; + validationResult = ValidationResult.Create(ValidationStatus.Error, validationMessages); + } + } + else + { + validationResult = ValidationResult.Create(ValidationStatus.NoValidation); + } + break; + case nameof(AudioConverterService): + if (Cuesheet.SplitPoints.Any()) + { + if (AudioConverterService == null) + { + var validationMessages = new List() + { + new("{0} has no value!", nameof(Exportprofile)) + }; + validationResult = ValidationResult.Create(ValidationStatus.Error, validationMessages); + } + else + { + validationResult = ValidationResult.Create(ValidationStatus.Success); + } + } + else + { + validationResult = ValidationResult.Create(ValidationStatus.NoValidation); + } + break; + default: + validationResult = ValidationResult.Create(ValidationStatus.NoValidation); + break; + } + return validationResult; + } } } diff --git a/AudioCuesheetEditor/Model/Options/ApplicationOptions.cs b/AudioCuesheetEditor/Model/Options/ApplicationOptions.cs index 47080595..51c0c1fb 100644 --- a/AudioCuesheetEditor/Model/Options/ApplicationOptions.cs +++ b/AudioCuesheetEditor/Model/Options/ApplicationOptions.cs @@ -51,8 +51,8 @@ public static IReadOnlyCollection AvailableCultures { var cultures = new List { - new CultureInfo("en-US"), - new CultureInfo("de-DE") + new("en-US"), + new("de-DE") }; return cultures.AsReadOnly(); } diff --git a/AudioCuesheetEditor/Resources/Localization/MainLayout/de.json b/AudioCuesheetEditor/Resources/Localization/MainLayout/de.json index 3c05e8d5..bec6bc09 100644 --- a/AudioCuesheetEditor/Resources/Localization/MainLayout/de.json +++ b/AudioCuesheetEditor/Resources/Localization/MainLayout/de.json @@ -8,7 +8,7 @@ "Undo last change": "Letzte Änderung Rückgängig machen", "Redo last change": "Letzte Änderung wiederherstellen", "Export": "Export", - "Please check processinghints for errors, otherwise the file is not exportable": "Bitte prüfen sie die Bearbeitungshinweise auf Fehler. Andernfalls ist Datei nicht exportierbar.", + "Please check processinghints for errors, otherwise the file is not exportable: {0}": "Bitte prüfen sie die Bearbeitungshinweise auf Fehler. Andernfalls ist Datei nicht exportierbar: {0}", "Download cuesheet": "Cuesheet herunterladen", "Save project": "Projekt speichern", "Open exportprofiles": "Export Profile anzeigen", diff --git a/AudioCuesheetEditor/Resources/Localization/MainLayout/en.json b/AudioCuesheetEditor/Resources/Localization/MainLayout/en.json index 7f454e10..a3788458 100644 --- a/AudioCuesheetEditor/Resources/Localization/MainLayout/en.json +++ b/AudioCuesheetEditor/Resources/Localization/MainLayout/en.json @@ -8,7 +8,7 @@ "Undo last change": "Undo last change", "Redo last change": "Redo last change", "Export": "Export", - "Please check processinghints for errors, otherwise the file is not exportable": "Please check processing hints for errors. Otherwise the file is not exportable.", + "Please check processinghints for errors, otherwise the file is not exportable: {0}": "Please check processinghints for errors, otherwise the file is not exportable: {0}", "Download cuesheet": "Download cuesheet", "Save project": "Save project", "Open exportprofiles": "Display Export Profiles", diff --git a/AudioCuesheetEditor/Resources/Localization/ModalExportdialog/de.json b/AudioCuesheetEditor/Resources/Localization/ModalExportdialog/de.json index eac76c46..8f6b5874 100644 --- a/AudioCuesheetEditor/Resources/Localization/ModalExportdialog/de.json +++ b/AudioCuesheetEditor/Resources/Localization/ModalExportdialog/de.json @@ -11,7 +11,7 @@ "Download this file": "Diese Datei herunterladen", "Generate export files": "Exportdateien generieren", "Abort": "Abbrechen", - "Export files can not be generated. Please check validationerrors and solve errors in order to download export.": "Exportdateien können nicht generiert werden. Bitte prüfen Sie die Validierungsfehler und beheben Sie diese, um die Exportdateien herunterladen zu können.", + "Export files can not be generated. Please check validationerrors and solve errors in order to download export: {0}": "Exportdateien können nicht generiert werden. Bitte prüfen Sie die Validierungsfehler und beheben Sie diese, um die Exportdateien herunterladen zu können: {0}", "Close": "Schließen", "Download split audio file": "Verarbeitete Audiodatei herunterladen", "Generation in progress, please stand by ...": "Export wird durchgeführt, bitte warten Sie ...." diff --git a/AudioCuesheetEditor/Resources/Localization/ModalExportdialog/en.json b/AudioCuesheetEditor/Resources/Localization/ModalExportdialog/en.json index de38cb79..0636febf 100644 --- a/AudioCuesheetEditor/Resources/Localization/ModalExportdialog/en.json +++ b/AudioCuesheetEditor/Resources/Localization/ModalExportdialog/en.json @@ -11,7 +11,7 @@ "Download this file": "Download this file", "Generate export files": "Generate export files", "Abort": "Abort", - "Export files can not be generated. Please check validationerrors and solve errors in order to download export.": "Export files can not be generated. Please check validationerrors and solve errors in order to download export.", + "Export files can not be generated. Please check validationerrors and solve errors in order to download export: {0}": "Export files can not be generated. Please check validationerrors and solve errors in order to download export: {0}", "Close": "Close", "Download split audio file": "Download split audio file", "Generation in progress, please stand by ...": "Generation in progress, please stand by ..." diff --git a/AudioCuesheetEditor/Resources/Localization/ValidationMessage/de.json b/AudioCuesheetEditor/Resources/Localization/ValidationMessage/de.json index 65d8ef4b..d0f65374 100644 --- a/AudioCuesheetEditor/Resources/Localization/ValidationMessage/de.json +++ b/AudioCuesheetEditor/Resources/Localization/ValidationMessage/de.json @@ -25,8 +25,9 @@ "SchemeType": "Schematyp", "Scheme": "Schema", "ENTER REGULAR EXPRESSION HERE": "Hier regulären Ausdruck eingeben", - "SchemeCuesheet": "Schema Cuesheet", - "SchemeTracks": "Schema Titel", + "SchemeHead": "Kopfschema", + "SchemeTracks": "Titelschema", + "SchemeFooter": "Fußschema", "Moment": "Zeitpunkt", "{0} must end with '{1}'!": "{0} musss mit '{1}' enden!", "{0} must have a filename!": "{0} muss einen Dateinamen haben!", diff --git a/AudioCuesheetEditor/Resources/Localization/ValidationMessage/en.json b/AudioCuesheetEditor/Resources/Localization/ValidationMessage/en.json index 22fc6d00..8f217b4c 100644 --- a/AudioCuesheetEditor/Resources/Localization/ValidationMessage/en.json +++ b/AudioCuesheetEditor/Resources/Localization/ValidationMessage/en.json @@ -25,8 +25,9 @@ "SchemeType": "Schemetype", "Scheme": "Scheme", "ENTER REGULAR EXPRESSION HERE": "Enter regular expression here", - "SchemeCuesheet": "Scheme cuesheet", - "SchemeTracks": "Scheme tracks", + "SchemeHead": "Headerscheme", + "SchemeTracks": "Trackscheme", + "SchemeFooter": "Footerscheme", "Moment": "Moment", "{0} must end with '{1}'!": "{0} must end with '{1}'!", "{0} must have a filename!": "{0} must have a filename!", diff --git a/AudioCuesheetEditor/Shared/MainLayout.razor b/AudioCuesheetEditor/Shared/MainLayout.razor index f5d077ef..f2449c96 100644 --- a/AudioCuesheetEditor/Shared/MainLayout.razor +++ b/AudioCuesheetEditor/Shared/MainLayout.razor @@ -98,9 +98,7 @@ along with Foobar. If not, see - - - + @@ -421,39 +419,25 @@ along with Foobar. If not, see { get { - String? text = null; - if (IsCuesheetExportable == false) + var generator = new ExportfileGenerator(ExportType.Cuesheet, _sessionStateContainer.Cuesheet, applicationOptions: applicationOptions, audioConverterService: _audioConverterService); + var validationResult = generator.Validate(); + if (validationResult.Status == Model.Entity.ValidationStatus.Error) { - text = _localizer["Please check processinghints for errors, otherwise the file is not exportable"]; - } - return text; - } - } - - Boolean IsCuesheetExportable - { - get - { - if (applicationOptions?.Validate(x => x.CuesheetFilename).Status != Model.Entity.ValidationStatus.Error) - { - var generator = new ExportfileGenerator(_sessionStateContainer.Cuesheet, applicationOptions: applicationOptions, audioConverterService: _audioConverterService); - return generator.CanWrite(ExportType.Cuesheet); - } - else - { - return false; + string? detailText = null; + if (validationResult.ValidationMessages != null) + { + foreach (var validationMessage in validationResult.ValidationMessages) + { + detailText += String.Format("{0}{1}", validationMessage.GetMessageLocalized(_validationMessageLocalizer), Environment.NewLine); + } + } + return _localizer["Please check processinghints for errors, otherwise the file is not exportable: {0}", detailText]; } + return null; } } - Boolean IsExportprofileExportable - { - get - { - var generator = new ExportfileGenerator(_sessionStateContainer.Cuesheet, SelectedExportProfile, audioConverterService: _audioConverterService); - return generator.CanWrite(ExportType.Exportprofile); - } - } + Boolean IsCuesheetExportable => IsCuesheetExportableTooltip == null; Boolean ModalExportdialogCuesheetLockUserInput { diff --git a/AudioCuesheetEditor/Shared/ModalExportdialog.razor b/AudioCuesheetEditor/Shared/ModalExportdialog.razor index 2de42131..9318493f 100644 --- a/AudioCuesheetEditor/Shared/ModalExportdialog.razor +++ b/AudioCuesheetEditor/Shared/ModalExportdialog.razor @@ -113,7 +113,7 @@ along with Foobar. If not, see { @if (selectedStep != "displayExportResult") { - + @@ -175,6 +175,27 @@ along with Foobar. If not, see } } + String? ExportPossibleTooltip + { + get + { + var validationResult = ExportfileGenerator?.Validate(); + if (validationResult?.Status == Model.Entity.ValidationStatus.Error) + { + string? detailText = null; + if (validationResult.ValidationMessages != null) + { + foreach (var validationMessage in validationResult.ValidationMessages) + { + detailText += String.Format("{0}{1}", validationMessage.GetMessageLocalized(_validationMessageLocalizer), Environment.NewLine); + } + } + return _localizer["Export files can not be generated. Please check validationerrors and solve errors in order to download export: {0}", detailText]; + } + return null; + } + } + Boolean ExportPossible { get @@ -184,11 +205,7 @@ along with Foobar. If not, see { exportPossible = Validations.ValidateAll().GetAwaiter().GetResult(); } - if ((exportPossible == false) && (ExportfileGenerator != null)) - { - exportPossible = ExportfileGenerator.CanWrite(ExportType); - } - return exportPossible; + return exportPossible && ExportPossibleTooltip == null; } } @@ -198,7 +215,7 @@ along with Foobar. If not, see .Add(Key.Enter, OnEnterKeyDown); _audioConverterService.ProgressChanged += IAudioConverterService_ProgressChanged; - ExportfileGenerator = new ExportfileGenerator(_sessionStateContainer.Cuesheet, audioConverterService: _audioConverterService); + ExportfileGenerator = new ExportfileGenerator(ExportType, _sessionStateContainer.Cuesheet, audioConverterService: _audioConverterService); await base.OnInitializedAsync(); } @@ -244,7 +261,7 @@ along with Foobar. If not, see exportProgress = 0; if (ExportfileGenerator != null) { - exportfiles = await ExportfileGenerator.GenerateExportfilesAsync(ExportType); + exportfiles = await ExportfileGenerator.GenerateExportfilesAsync(); selectedStep = "displayExportResult"; prepareExportCompleted = true; } diff --git a/AudioCuesheetEditorTests/Model/IO/Export/ExportfileGeneratorTests.cs b/AudioCuesheetEditorTests/Model/IO/Export/ExportfileGeneratorTests.cs index 69a21f3d..a58f4c74 100644 --- a/AudioCuesheetEditorTests/Model/IO/Export/ExportfileGeneratorTests.cs +++ b/AudioCuesheetEditorTests/Model/IO/Export/ExportfileGeneratorTests.cs @@ -56,8 +56,8 @@ public async Task GenerateCuesheetFilesTestAsync() track.End = begin; cuesheet.AddTrack(track, testHelper.ApplicationOptions); } - var generator = new ExportfileGenerator(cuesheet, applicationOptions: testHelper.ApplicationOptions); - var generatedFiles = await generator.GenerateExportfilesAsync(ExportType.Cuesheet); + var generator = new ExportfileGenerator(ExportType.Cuesheet, cuesheet, applicationOptions: testHelper.ApplicationOptions); + var generatedFiles = await generator.GenerateExportfilesAsync(); Assert.AreEqual(1, generatedFiles.Count); Assert.AreEqual(Exportfile.DefaultCuesheetFilename, generatedFiles.First().Name); var content = generatedFiles.First().Content; @@ -83,7 +83,7 @@ public async Task GenerateCuesheetFilesTestAsync() File.Delete(fileName); cuesheet.CDTextfile = new CDTextfile("Testfile.cdt"); cuesheet.Cataloguenumber.Value = "0123456789123"; - generatedFiles = await generator.GenerateExportfilesAsync(ExportType.Cuesheet); + generatedFiles = await generator.GenerateExportfilesAsync(); Assert.AreEqual(1, generatedFiles.Count); content = generatedFiles.First().Content; Assert.IsNotNull(content); @@ -95,8 +95,8 @@ public async Task GenerateCuesheetFilesTestAsync() File.Delete(fileName); cuesheet.CDTextfile = new CDTextfile("Testfile.cdt"); cuesheet.Cataloguenumber.Value = "Testvalue"; - Assert.IsFalse(generator.CanWrite(ExportType.Cuesheet)); - generatedFiles = await generator.GenerateExportfilesAsync(ExportType.Cuesheet); + Assert.AreEqual(ValidationStatus.Error, generator.Validate().Status); + generatedFiles = await generator.GenerateExportfilesAsync(); Assert.AreEqual(0, generatedFiles.Count); } @@ -131,8 +131,8 @@ public async Task GenerateCuesheetFilesWithPreGapAndPostGapTestAsync() track.PreGap = new TimeSpan(0, 0, 3); cuesheet.AddTrack(track, testHelper.ApplicationOptions); } - var generator = new ExportfileGenerator(cuesheet, applicationOptions: testHelper.ApplicationOptions); - var generatedFiles = await generator.GenerateExportfilesAsync(ExportType.Cuesheet); + var generator = new ExportfileGenerator(ExportType.Cuesheet, cuesheet, applicationOptions: testHelper.ApplicationOptions); + var generatedFiles = await generator.GenerateExportfilesAsync(); Assert.AreEqual(1, generatedFiles.Count); var content = generatedFiles.First().Content; Assert.IsNotNull(content); @@ -193,8 +193,8 @@ public async Task GenerateCuesheetFilesWithTrackFlagsTestAsync() } cuesheet.AddTrack(track, testHelper.ApplicationOptions); } - var generator = new ExportfileGenerator(cuesheet, applicationOptions: testHelper.ApplicationOptions); - var generatedFiles = await generator.GenerateExportfilesAsync(ExportType.Cuesheet); + var generator = new ExportfileGenerator(ExportType.Cuesheet, cuesheet, applicationOptions: testHelper.ApplicationOptions); + var generatedFiles = await generator.GenerateExportfilesAsync(); Assert.AreEqual(1, generatedFiles.Count); var content = generatedFiles.First().Content; Assert.IsNotNull(content); @@ -245,16 +245,16 @@ public async Task GenerateCuesheetFilesWithIncorrectTrackPositionsTestAsync() track.End = begin; cuesheet.AddTrack(track, testHelper.ApplicationOptions); } - var generator = new ExportfileGenerator(cuesheet, applicationOptions: testHelper.ApplicationOptions); - Assert.IsFalse(generator.CanWrite(ExportType.Cuesheet)); + var generator = new ExportfileGenerator(ExportType.Cuesheet, cuesheet, applicationOptions: testHelper.ApplicationOptions); + Assert.AreEqual(ValidationStatus.Error, generator.Validate().Status); //Rearrange positions cuesheet.Tracks.ElementAt(0).Position = 1; cuesheet.Tracks.ElementAt(1).Position = 2; cuesheet.Tracks.ElementAt(2).Position = 3; cuesheet.Tracks.ElementAt(3).Position = 4; cuesheet.Tracks.ElementAt(4).Position = 5; - Assert.IsTrue(generator.CanWrite(ExportType.Cuesheet)); - var generatedFiles = await generator.GenerateExportfilesAsync(ExportType.Cuesheet); + Assert.AreEqual(ValidationStatus.Success, generator.Validate().Status); + var generatedFiles = await generator.GenerateExportfilesAsync(); Assert.AreEqual(1, generatedFiles.Count); var content = generatedFiles.First().Content; Assert.IsNotNull(content); @@ -315,9 +315,9 @@ public async Task GenerateCuesheetFilesWithSplitPointsTestAsync() splitPoint.Title = "Title 3"; splitPoint.Moment = new TimeSpan(1, 30, 0); testHelper.ApplicationOptions.CuesheetFilename = "Unit test.cue"; - var generator = new ExportfileGenerator(cuesheet, applicationOptions: testHelper.ApplicationOptions, audioConverterService:testHelper.AudioConverterService); - Assert.IsTrue(generator.CanWrite(ExportType.Cuesheet)); - var generatedFiles = await generator.GenerateExportfilesAsync(ExportType.Cuesheet); + var generator = new ExportfileGenerator(ExportType.Cuesheet, cuesheet, applicationOptions: testHelper.ApplicationOptions, audioConverterService:testHelper.AudioConverterService); + Assert.AreEqual(ValidationStatus.Success, generator.Validate().Status); + var generatedFiles = await generator.GenerateExportfilesAsync(); Assert.AreEqual(5, generatedFiles.Count); var position = 1; var counter = 1; @@ -427,8 +427,8 @@ public async Task GenerateExportfilesTestAsync() SchemeFooter = "Exported %Cuesheet.Title% from %Cuesheet.Artist% using AudioCuesheetEditor" }; Assert.AreEqual(ValidationStatus.Success, exportProfile.Validate().Status); - var generator = new ExportfileGenerator(cuesheet, exportprofile: exportProfile); - var generatedFiles = await generator.GenerateExportfilesAsync(ExportType.Exportprofile); + var generator = new ExportfileGenerator(ExportType.Exportprofile, cuesheet, exportprofile: exportProfile); + var generatedFiles = await generator.GenerateExportfilesAsync(); Assert.AreEqual(1, generatedFiles.Count); Assert.AreEqual(exportProfile.Filename, generatedFiles.First().Name); var fileContent = generatedFiles.First().Content; @@ -461,7 +461,7 @@ public async Task GenerateExportfilesTestAsync() }; Assert.AreEqual(ValidationStatus.Success, exportProfile.Validate().Status); generator.Exportprofile = exportProfile; - generatedFiles = await generator.GenerateExportfilesAsync(ExportType.Exportprofile); + generatedFiles = await generator.GenerateExportfilesAsync(); Assert.AreEqual(1, generatedFiles.Count); Assert.AreEqual(exportProfile.Filename, generatedFiles.First().Name); fileContent = generatedFiles.First().Content; @@ -495,7 +495,7 @@ public async Task GenerateExportfilesTestAsync() }; Assert.AreEqual(ValidationStatus.Success, exportProfile.Validate().Status); generator.Exportprofile = exportProfile; - generatedFiles = await generator.GenerateExportfilesAsync(ExportType.Exportprofile); + generatedFiles = await generator.GenerateExportfilesAsync(); Assert.AreEqual(1, generatedFiles.Count); Assert.AreEqual(exportProfile.Filename, generatedFiles.First().Name); fileContent = generatedFiles.First().Content; @@ -565,8 +565,8 @@ public async Task GenerateExportfilesWithPregapAndPostgapTestAsync() SchemeFooter = "Exported %Cuesheet.Title% from %Cuesheet.Artist% using AudioCuesheetEditor at %Date%" }; Assert.AreEqual(ValidationStatus.Success, exportProfile.Validate().Status); - var generator = new ExportfileGenerator(cuesheet, exportprofile: exportProfile); - var generatedFiles = await generator.GenerateExportfilesAsync(ExportType.Exportprofile); + var generator = new ExportfileGenerator(ExportType.Exportprofile, cuesheet, exportprofile: exportProfile); + var generatedFiles = await generator.GenerateExportfilesAsync(); Assert.AreEqual(1, generatedFiles.Count); Assert.AreEqual(exportProfile.Filename, generatedFiles.First().Name); var fileContent = generatedFiles.First().Content; @@ -641,9 +641,9 @@ public async Task GenerateExportfilesWithSplitPointsTestAsync() SchemeTracks = "%Track.Position%;%Track.Artist%;%Track.Title%;%Track.Begin%;%Track.End%;%Track.Length%", SchemeFooter = "Exported %Cuesheet.Title% from %Cuesheet.Artist% using AudioCuesheetEditor" }; - var generator = new ExportfileGenerator(cuesheet, exportProfile, audioConverterService: testHelper.AudioConverterService); - Assert.IsTrue(generator.CanWrite(ExportType.Exportprofile)); - var generatedFiles = await generator.GenerateExportfilesAsync(ExportType.Exportprofile); + var generator = new ExportfileGenerator(ExportType.Exportprofile, cuesheet, exportProfile, audioConverterService: testHelper.AudioConverterService); + Assert.AreEqual(ValidationStatus.Success, generator.Validate().Status); + var generatedFiles = await generator.GenerateExportfilesAsync(); Assert.AreEqual(5, generatedFiles.Count); //Check split according to split points