diff options
Diffstat (limited to 'lib/simfile.dart')
-rw-r--r-- | lib/simfile.dart | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/simfile.dart b/lib/simfile.dart index 102c989..764e3aa 100644 --- a/lib/simfile.dart +++ b/lib/simfile.dart @@ -37,7 +37,10 @@ class Chart { } class Simfile { - String path; + String directoryPath; + String? simfilePath; + String? audioPath; + String? bannerPath; String? lines; // tags of simfile @@ -48,7 +51,7 @@ class Simfile { Map<double, double> bpms = {}; double offset = 0; - Simfile(this.path); + Simfile(this.directoryPath); void _parseChart({required List<String> keys, required String value}) { Chart chart = Chart(); @@ -118,7 +121,18 @@ class Simfile { } void load() { - lines = File(path).readAsStringSync(); + simfilePath = Directory(directoryPath) + .listSync() + .firstWhere((entity) => entity.path.endsWith('.sm'), + orElse: () => File('')).path; + + audioPath = Directory(directoryPath) + .listSync() + .firstWhere((entity) => entity.path.endsWith('.ogg'), + orElse: () => File('')) + .path; + + lines = File(simfilePath!).readAsStringSync(); RegExp commentsRegExp = RegExp(r'//.*$'); lines = lines?.replaceAll(commentsRegExp, ''); |