Skip to content

Commit

Permalink
added import of flags
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoCoderMatrix86 committed Aug 27, 2024
1 parent efb987b commit b8d88ff
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
19 changes: 10 additions & 9 deletions AudioCuesheetEditor/Model/AudioCuesheet/ITrack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ namespace AudioCuesheetEditor.Model.AudioCuesheet
{
public interface ITrack
{
public string? Artist { get; set; }
public string? Title { get; set; }
public uint? Position { get; set; }
public TimeSpan? Begin { get; set; }
public TimeSpan? End { get; set; }
public TimeSpan? Length { get; set; }
//TODO: Flags
public TimeSpan? PreGap { get; set; }
public TimeSpan? PostGap { get; set; }
string? Artist { get; set; }
string? Title { get; set; }
uint? Position { get; set; }
TimeSpan? Begin { get; set; }
TimeSpan? End { get; set; }
TimeSpan? Length { get; set; }
IReadOnlyCollection<Flag> Flags { get; }
TimeSpan? PreGap { get; set; }
TimeSpan? PostGap { get; set; }
void SetFlags(IEnumerable<Flag> flags);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,20 @@ namespace AudioCuesheetEditor.Model.AudioCuesheet.Import
{
public class ImportTrack : ITrack
{
private readonly List<Flag> flags = [];
public string? Artist { get; set; }
public string? Title { get; set; }
public uint? Position { get; set; }
public TimeSpan? Begin { get; set; }
public TimeSpan? End { get; set; }
public TimeSpan? Length { get; set; }
//TODO: Flags
public IReadOnlyCollection<Flag> Flags => flags;
public TimeSpan? PreGap { get; set; }
public TimeSpan? PostGap { get; set; }
public void SetFlags(IEnumerable<Flag> flags)
{
this.flags.Clear();
this.flags.AddRange(flags);
}
}
}
19 changes: 9 additions & 10 deletions AudioCuesheetEditor/Model/AudioCuesheet/Track.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,16 +315,15 @@ public void CopyValues(ITrack track, Boolean setCuesheet = true, Boolean setIsLi
}
if (setFlags)
{
//TODO
//if ((useInternalSetters != null) && (useInternalSetters.Contains(nameof(Flags))))
//{
// flags.Clear();
// flags.AddRange(track.Flags);
//}
//else
//{
// SetFlags(track.Flags);
//}
if ((useInternalSetters != null) && (useInternalSetters.Contains(nameof(Flags))))
{
flags.Clear();
flags.AddRange(track.Flags);
}
else
{
SetFlags(track.Flags);
}
}
if (setPreGap)
{
Expand Down
2 changes: 1 addition & 1 deletion AudioCuesheetEditor/Services/IO/TextImportService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private void SetValue(object entity, PropertyInfo property, string value)
if (property.PropertyType == typeof(IReadOnlyCollection<Flag>))
{
var list = Flag.AvailableFlags.Where(x => value.Contains(x.CuesheetLabel));
((Track)entity).SetFlags(list);
((ITrack)entity).SetFlags(list);
}
if (property.PropertyType == typeof(Audiofile))
{
Expand Down

0 comments on commit b8d88ff

Please sign in to comment.