public NotatedTrackInfo(FileTrackInfo source) { this.Identifier = source.Identifier; this.Title = source.Title; this.ScoreSystemHeight = source.ScoreSystemHeight; this.ScoreSystemInterval = source.ScoreSystemInterval; }
private void LoadTracks(JcfMedia media, string songPath) { var trackskArray = PropertyListParser.Parse(Path.Combine(songPath, "tracks.plist")) as NSArray; foreach (var track in trackskArray) { var dict = track as NSDictionary; if (dict == null) { continue; } Guid guid = Guid.Parse(dict.String("identifier")); string id = guid.ToString().ToUpper(); string type = dict.String("class"); switch (type) { case "JMEmptyTrack": //TODO break; case "JMFileTrack": var source = new FileTrackInfo { Identifier = guid, Title = dict.String("title"), ScoreSystemHeight = (uint)dict.Int("scoreSystemHeight"), ScoreSystemInterval = (uint)dict.Int("scoreSystemInterval") }; var notationPages = Directory.GetFiles(songPath, $"{id}_jcfn_??").Length; var tablaturePages = Directory.GetFiles(songPath, $"{id}_jcft_??").Length; if (notationPages + tablaturePages > 0) { var notated = new NotatedTrackInfo(source) { NotationPages = (uint)notationPages, TablaturePages = (uint)tablaturePages }; media.InstrumentTracks.Add(notated); media.Scores.Add(new ScoreInfo(notated, "Score")); if (tablaturePages > 0) { media.Scores.Add(new ScoreInfo(notated, "Tablature")); } } else { media.BackingTrack = source; } break; default: switch (dict.Count) { case 2: break;//TODO case 3: if ("JMClickTrack" == type) { media.ClickTrack = new PlayableTrackInfo() { Class = type, Identifier = guid, Title = dict.String("title") } } ; break; default: throw new Exception("Unrecognized track info.\n" + dict.ToString()); } break; } } } // LoadTracks(JcfMedia, string)