-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from TheBoxyBear/beta
Bulk IO operations
- Loading branch information
Showing
18 changed files
with
609 additions
and
485 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,5 +33,4 @@ static ChartSection() | |
|
||
DefaultReservedHeaders = new(headers); | ||
} | ||
public ChartSection() : base() { } | ||
} |
8 changes: 6 additions & 2 deletions
8
ChartTools/IO/Chart/Configuration/Sessions/ChartReadingSession.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
namespace ChartTools.IO.Components; | ||
|
||
public record ComponentList() | ||
{ | ||
public static ComponentList Global() => new() | ||
{ | ||
Metadata = true, | ||
SyncTrack = true, | ||
GlobalEvents = true | ||
}; | ||
|
||
public static ComponentList Full() => new() | ||
{ | ||
Metadata = true, | ||
SyncTrack = true, | ||
GlobalEvents = true, | ||
Instruments = InstrumentComponentList.Full() | ||
}; | ||
|
||
public bool Metadata { get; set; } | ||
public bool SyncTrack { get; set; } | ||
public bool GlobalEvents { get; set; } | ||
|
||
public InstrumentComponentList Instruments { get; set; } = new(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
namespace ChartTools.IO.Components; | ||
|
||
[Flags] | ||
public enum DifficultySet : byte | ||
{ | ||
None = 0, | ||
Easy = 1 << 0, | ||
Medium = 1 << 1, | ||
Hard = 1 << 2, | ||
Expert = 1 << 3, | ||
All = Easy | Medium | Hard | Expert | ||
}; | ||
|
||
|
||
public static class DifficultyExtensions | ||
{ | ||
public static DifficultySet ToSet(this Difficulty difficulty) => (DifficultySet)(1 << (int)difficulty); | ||
} | ||
|
||
public record InstrumentComponentList() | ||
{ | ||
public static InstrumentComponentList Full() => new() | ||
{ | ||
Drums = DifficultySet.All, | ||
LeadGuitar = DifficultySet.All, | ||
CoopGuitar = DifficultySet.All, | ||
RythmGuitar = DifficultySet.All, | ||
Bass = DifficultySet.All, | ||
GHLGuitar = DifficultySet.All, | ||
GHLBass = DifficultySet.All, | ||
Keys = DifficultySet.All, | ||
Vocals = DifficultySet.All | ||
}; | ||
|
||
public DifficultySet Drums | ||
{ | ||
get => _drums; | ||
set => _drums = value; | ||
} | ||
private DifficultySet _drums; | ||
|
||
public DifficultySet LeadGuitar | ||
{ | ||
get => _leadGuitar; | ||
set => _leadGuitar = value; | ||
} | ||
private DifficultySet _leadGuitar; | ||
|
||
public DifficultySet CoopGuitar | ||
{ | ||
get => _coopGuitar; | ||
set => _coopGuitar = value; | ||
} | ||
private DifficultySet _coopGuitar; | ||
|
||
public DifficultySet RythmGuitar | ||
{ | ||
get => _rythmGuitar; | ||
set => _rythmGuitar = value; | ||
} | ||
private DifficultySet _rythmGuitar; | ||
|
||
public DifficultySet Bass | ||
{ | ||
get => _bass; | ||
set => _bass = value; | ||
} | ||
private DifficultySet _bass; | ||
|
||
public DifficultySet GHLGuitar | ||
{ | ||
get => _ghlGuitar; | ||
set => _ghlGuitar = value; | ||
} | ||
private DifficultySet _ghlGuitar; | ||
|
||
public DifficultySet GHLBass | ||
{ | ||
get => _ghlBass; | ||
set => _ghlBass = value; | ||
} | ||
private DifficultySet _ghlBass; | ||
|
||
public DifficultySet Keys | ||
{ | ||
get => _keys; | ||
set => _keys = value; | ||
} | ||
private DifficultySet _keys; | ||
|
||
public DifficultySet Vocals | ||
{ | ||
get => _vocals; | ||
set => _vocals = value; | ||
} | ||
private DifficultySet _vocals; | ||
|
||
public InstrumentComponentList(InstrumentIdentity identity, DifficultySet difficulties = DifficultySet.All) : this() | ||
{ | ||
Validator.ValidateEnum(identity); | ||
Validator.ValidateEnum(difficulties); | ||
|
||
Map(identity) = difficulties; | ||
} | ||
|
||
public InstrumentComponentList(StandardInstrumentIdentity identity, DifficultySet difficulties = DifficultySet.All) : this() | ||
{ | ||
Validator.ValidateEnum(identity); | ||
Validator.ValidateEnum(difficulties); | ||
|
||
Map((InstrumentIdentity)identity) = difficulties; | ||
} | ||
|
||
public InstrumentComponentList(GHLInstrumentIdentity identity, DifficultySet difficulties = DifficultySet.All) : this() | ||
{ | ||
Validator.ValidateEnum(identity); | ||
Validator.ValidateEnum(difficulties); | ||
|
||
Map((InstrumentIdentity)identity) = difficulties; | ||
} | ||
|
||
public ref DifficultySet Map(InstrumentIdentity instrument) | ||
{ | ||
switch (instrument) | ||
{ | ||
case InstrumentIdentity.Drums: | ||
return ref _drums; | ||
case InstrumentIdentity.LeadGuitar: | ||
return ref _leadGuitar; | ||
case InstrumentIdentity.CoopGuitar: | ||
return ref _coopGuitar; | ||
case InstrumentIdentity.RhythmGuitar: | ||
return ref _rythmGuitar; | ||
case InstrumentIdentity.Bass: | ||
return ref _bass; | ||
case InstrumentIdentity.GHLGuitar: | ||
return ref _ghlGuitar; | ||
case InstrumentIdentity.GHLBass: | ||
return ref _ghlBass; | ||
case InstrumentIdentity.Keys: | ||
return ref _keys; | ||
case InstrumentIdentity.Vocals: | ||
return ref _vocals; | ||
default: | ||
throw new UndefinedEnumException(instrument); | ||
} | ||
} | ||
|
||
public ref DifficultySet Map(StandardInstrumentIdentity instrument) | ||
{ | ||
Validator.ValidateEnum(instrument); | ||
return ref Map((InstrumentIdentity)(instrument)); | ||
} | ||
|
||
public ref DifficultySet Map(GHLInstrumentIdentity instrument) | ||
{ | ||
Validator.ValidateEnum(instrument); | ||
return ref Map((InstrumentIdentity)(instrument)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
namespace ChartTools.IO.Ini; | ||
using ChartTools.IO.Parsing; | ||
|
||
internal class IniFileReader : TextFileReader | ||
namespace ChartTools.IO.Ini; | ||
|
||
internal class IniFileReader(string path, Metadata? existing) : TextFileReader(path) | ||
{ | ||
public override IEnumerable<IniParser> Parsers => base.Parsers.Cast<IniParser>(); | ||
|
||
public IniFileReader(string path, Func<string, IniParser?> parserGetter) : base(path, parserGetter) { } | ||
protected override TextParser? GetParser(string header) => header.Equals(IniFormatting.Header, StringComparison.OrdinalIgnoreCase) ? new IniParser(existing) : null; | ||
|
||
protected override bool IsSectionStart(string line) => !line.StartsWith('['); | ||
} |
Oops, something went wrong.