Skip to content

Commit

Permalink
Best practise corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoCoderMatrix86 committed May 23, 2024
1 parent 78f31de commit 07c07ce
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions AudioCuesheetEditor/Model/IO/Export/Exportprofile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ protected override ValidationResult Validate(string property)
{
if (SchemeHead.Contains(availableScheme.Value) == true)
{
validationMessages ??= new();
validationMessages ??= [];
validationMessages.Add(new ValidationMessage("{0} contains placeholder '{1}' that can not be resolved!", nameof(SchemeHead), availableScheme.Value));
break;
}
Expand All @@ -162,7 +162,7 @@ protected override ValidationResult Validate(string property)
{
if (SchemeTracks.Contains(availableScheme.Value) == true)
{
validationMessages ??= new();
validationMessages ??= [];
validationMessages.Add(new ValidationMessage("{0} contains placeholder '{1}' that can not be resolved!", nameof(SchemeTracks), availableScheme.Value));
break;
}
Expand All @@ -174,7 +174,7 @@ protected override ValidationResult Validate(string property)
{
if (SchemeFooter.Contains(availableScheme.Value) == true)
{
validationMessages ??= new();
validationMessages ??= [];
validationMessages.Add(new ValidationMessage("{0} contains placeholder '{1}' that can not be resolved!", nameof(SchemeFooter), availableScheme.Value));
break;
}
Expand All @@ -184,15 +184,15 @@ protected override ValidationResult Validate(string property)
validationStatus = ValidationStatus.Success;
if (String.IsNullOrEmpty(Filename))
{
validationMessages ??= new();
validationMessages ??= [];
validationMessages.Add(new ValidationMessage("{0} has no value!", nameof(Filename)));
}
break;
case nameof(Name):
validationStatus = ValidationStatus.Success;
if (String.IsNullOrEmpty(Name))
{
validationMessages ??= new();
validationMessages ??= [];
validationMessages.Add(new ValidationMessage("{0} has no value!", nameof(Name)));
}
break;
Expand Down
18 changes: 9 additions & 9 deletions AudioCuesheetEditor/Model/Options/ApplicationOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,21 @@ protected override ValidationResult Validate(string property)
validationStatus = ValidationStatus.Success;
if (string.IsNullOrEmpty(CuesheetFilename))
{
validationMessages ??= new();
validationMessages ??= [];
validationMessages.Add(new ValidationMessage("{0} has no value!", nameof(CuesheetFilename)));
}
else
{
var extension = Path.GetExtension(CuesheetFilename);
if (extension.Equals(Cuesheet.FileExtension, StringComparison.OrdinalIgnoreCase) == false)
{
validationMessages ??= new();
validationMessages ??= [];
validationMessages.Add(new ValidationMessage("{0} must end with '{1}'!", nameof(CuesheetFilename), Cuesheet.FileExtension));
}
var filenameWithoutExtension = Path.GetFileNameWithoutExtension(CuesheetFilename);
if (string.IsNullOrEmpty(filenameWithoutExtension))
{
validationMessages ??= new();
validationMessages ??= [];
validationMessages.Add(new ValidationMessage("{0} must have a filename!", nameof(CuesheetFilename)));
}
}
Expand All @@ -147,21 +147,21 @@ protected override ValidationResult Validate(string property)
validationStatus = ValidationStatus.Success;
if (String.IsNullOrEmpty(RecordedAudiofilename))
{
validationMessages ??= new();
validationMessages ??= [];
validationMessages.Add(new ValidationMessage("{0} has no value!", nameof(RecordedAudiofilename)));
}
else
{
var extension = Path.GetExtension(RecordedAudiofilename);
if (extension.Equals(Audiofile.AudioCodecWEBM.FileExtension, StringComparison.OrdinalIgnoreCase) == false)
{
validationMessages ??= new();
validationMessages ??= [];
validationMessages.Add(new ValidationMessage("{0} must end with '{1}'!", nameof(RecordedAudiofilename), Audiofile.AudioCodecWEBM.FileExtension));
}
var filename = Path.GetFileNameWithoutExtension(RecordedAudiofilename);
if (String.IsNullOrEmpty(filename))
{
validationMessages ??= new();
validationMessages ??= [];
validationMessages.Add(new ValidationMessage("{0} must have a filename!", nameof(RecordedAudiofilename)));
}
}
Expand All @@ -170,21 +170,21 @@ protected override ValidationResult Validate(string property)
validationStatus = ValidationStatus.Success;
if (String.IsNullOrEmpty(ProjectFilename))
{
validationMessages ??= new();
validationMessages ??= [];
validationMessages.Add(new ValidationMessage("{0} has no value!", nameof(ProjectFilename)));
}
else
{
var extension = Path.GetExtension(ProjectFilename);
if (extension.Equals(Projectfile.FileExtension, StringComparison.OrdinalIgnoreCase) == false)
{
validationMessages ??= new();
validationMessages ??= [];
validationMessages.Add(new ValidationMessage("{0} must end with '{1}'!", nameof(ProjectFilename), Projectfile.FileExtension));
}
var filename = Path.GetFileNameWithoutExtension(ProjectFilename);
if (String.IsNullOrEmpty(filename))
{
validationMessages ??= new();
validationMessages ??= [];
validationMessages.Add(new ValidationMessage("{0} must have a filename!", nameof(ProjectFilename)));
}
}
Expand Down
6 changes: 3 additions & 3 deletions AudioCuesheetEditor/Model/Options/ExportOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ namespace AudioCuesheetEditor.Model.Options
{
public class ExportOptions : IOptions
{
public static readonly List<Exportprofile> DefaultExportProfiles = new()
{
public static readonly List<Exportprofile> DefaultExportProfiles =
[
new Exportprofile()
{
Filename = "YouTube.txt",
Expand Down Expand Up @@ -48,7 +48,7 @@ public class ExportOptions : IOptions
Name = "Tracks only",
SchemeTracks = "%Track.Position% - %Track.Artist% - %Track.Title% - %Track.Begin% - %Track.End% - %Track.Length%",
}
};
];
public IReadOnlyCollection<Exportprofile> ExportProfiles { get; set; } = DefaultExportProfiles;
}
}

0 comments on commit 07c07ce

Please sign in to comment.