public MusicalEventKvant(MusicalEvent musEvent, int localNumber, int globalNumber, double duration, int midiNote, int midiNoteHmm) { LocalNumber = localNumber; GlobalNumber = globalNumber; Event = musEvent; Duration = duration; MidiNote = midiNote; MidiNoteHmm = MidiNoteHmm; }
private void SetupPerformances <T>(MusicalEvent musicalEvent, string performanceData, List <MusicalEntity> musicalEntities) where T : Performance, new() { // Imported Performances are stored in a list of MusicalEntity Names (not SortNames), delimited by a semi colon // For example: You Am I;Something for Kate;British India, sees a lineup with You Am I, Something for Kate and // British India all playing sets // Within each Performance, there are a bunch of extra options: // If MusicalEntity or MusicalEntities are performing under a different name, it will appear at the end, separated by a Pipe // e.g. Something for Kate|George Kaplan and the Editors (Something for Kate peforming as "George Kaplan and the Editors") // If multiple MusicEntities are performing together, these are included in the performance, separated by a comma // e.g. You Am I,Paul Dempsey,Adalita|You Am I All-Stars. (In this case You Am I, Paul Dempsey and Adalita // performing together as the "You Am I All-Stars") // Finally, if the performance was not seen, but still needs to be listed (i.e. in the case of missing a Headliner), // this denoted by a [x] at the end of Performance: Motor Ace[x] // This could probably be done by Regular Expressions, but a simple series of string manipulations will // do for now string[] performances = performanceData.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); foreach (var performanceDetails in performances) { string details = performanceDetails; // Create the performance var performance = new T(); performance.Position = musicalEvent.Lineup.Count + 1; performance.Event = musicalEvent; // Check to see if this peformance was missed if (details.EndsWith("[x]")) { performance.Attended = false; // Remove the "[x]" off the end of the string details = details.Substring(0, details.Length - 3); } // Find out if there is a 'Performing as...' string[] parts = details.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); if (parts.Count() > 1) { performance.PerformingAs = parts[1]; } // Check to see if there are more than one artist performing in this particular performance.... string[] performerNames = parts[0].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); // Add in the performers foreach (var performerName in performerNames) { var performer = musicalEntities.First(e => e.Name.ToLower() == performerName.ToLower()); performance.Performers.Add(new Performer(performance.Performers.Count + 1, performer)); performer.Performances.Add(performance); } musicalEvent.Lineup.Add(performance); } }