public ChartParser LoadMidi() { string name = ""; name = name + new FileInfo(this.fileLocation).Name + ":\n"; try { this.midiReader = MIDIReader.smethod_0(this.fileLocation); } catch (Exception) { throw new IOException(name + "Unknown Error: Could not parse MIDI sequence."); } foreach (MIDILine current in this.midiReader.getMidiLineList()) { if (current.method_2().Equals("PART GUITAR")) { this.isPartGuitar = true; } else if (current.method_2().Equals("EVENTS")) { this.isEvents = true; } } if (this.midiReader.getMidiLineList().Count == 1 && !this.isPartGuitar) { this.midiReader.getMidiLineList()[0].method_3("PART GUITAR"); this.isPartGuitar = true; } if (!this.isPartGuitar) { throw new IOException(name + "PART GUITAR not found. No chart created."); } ChartParser chartParser = new ChartParser(); this.bpmInterpreter = chartParser.bpmInterpreter; this.sectionInterpreter = chartParser.sectionInterpreter; chartParser.difficultyWithNotes.Add("EasySingle", this.easySingle); chartParser.difficultyWithNotes.Add("MediumSingle", this.mediumSingle); chartParser.difficultyWithNotes.Add("HardSingle", this.hardSingle); chartParser.difficultyWithNotes.Add("ExpertSingle", this.expertSingle); chartParser.difficultyWithNotes.Add("EasyDoubleGuitar", this.easyDoubleGuitar); chartParser.difficultyWithNotes.Add("MediumDoubleGuitar", this.mediumDoubleGuitar); chartParser.difficultyWithNotes.Add("HardDoubleGuitar", this.hardDoubleGuitar); chartParser.difficultyWithNotes.Add("ExpertDoubleGuitar", this.expertDoubleGuitar); chartParser.difficultyWithNotes.Add("EasyDoubleBass", this.easyDoubleBass); chartParser.difficultyWithNotes.Add("MediumDoubleBass", this.mediumDoubleBass); chartParser.difficultyWithNotes.Add("HardDoubleBass", this.hardDoubleBass); chartParser.difficultyWithNotes.Add("ExpertDoubleBass", this.expertDoubleBass); chartParser.instrumentList.Add("EasyDrums", this.easyDrums); chartParser.instrumentList.Add("MediumDrums", this.mediumDrums); chartParser.instrumentList.Add("HardDrums", this.hardDrums); chartParser.instrumentList.Add("ExpertDrums", this.expertDrums); chartParser.instrumentList.Add("EasyKeyboard", this.easyKeyboard); chartParser.instrumentList.Add("MediumKeyboard", this.mediumKeyboard); chartParser.instrumentList.Add("HardKeyboard", this.hardKeyboard); chartParser.instrumentList.Add("ExpertKeyboard", this.expertKeyboard); chartParser.constant480 = 480; this.resolution = 480.0 / (double)this.midiReader.method_0(); object obj = name; name = string.Concat(new object[] { obj, "NumTracks = ", this.midiReader.getMidiLineList().Count, "\n" }); this.method_1(this.midiReader.getMidiLineList()[0]); foreach (MIDILine midiLine in this.midiReader.getMidiLineList()) { if (midiLine.method_2().Equals("PART GUITAR")) { this.getNotes(midiLine, 0); } else if (midiLine.method_2().Equals("T1 GEMS")) { this.getNotes(midiLine, 0); } else if (midiLine.method_2().Equals("PART GUITAR COOP")) { this.getNotes(midiLine, 1); } else if (midiLine.method_2().Equals("PART RHYTHM")) { this.notBass = true; this.getNotes(midiLine, 3); } else if (midiLine.method_2().Equals("PART BASS")) { this.getNotes(midiLine, 3); } else if (midiLine.method_2().Equals("EVENTS")) { this.getNotes(midiLine, 4); } else if (midiLine.method_2().Equals("BAND DRUMS")) { this.getNotes(midiLine, 5); } else if (midiLine.method_2().Equals("BAND KEYS")) { this.getNotes(midiLine, 7); } else { name = name + "Track (" + midiLine.method_2() + ") ignored.\n"; } } chartParser.gh3SongInfo.title = this.songTitle; chartParser.gh3SongInfo.not_bass = this.notBass; name += "Conversion Complete!"; Console.WriteLine(name); chartParser.removeEmptyParts(); return(chartParser); }
public ChartParser(string string_0, bool nothing) { List<string> list = new List<string>(); StringReader stringReader = new StringReader(string_0); string bracketItems = null; string bracketItemsWithBrackets; while ((bracketItemsWithBrackets = stringReader.ReadLine()) != null) { if (bracketItemsWithBrackets.StartsWith("[")) { bracketItems = bracketItemsWithBrackets.Split(new char[] { '[', ']' }, StringSplitOptions.RemoveEmptyEntries)[0]; } else if (!bracketItemsWithBrackets.Equals("{")) { if (bracketItemsWithBrackets.Equals("}")) { string a; if ((a = bracketItems) == null) { goto IL_477; } if (a == "Song") { this.gh3SongInfo.editable = true; using (List<string>.Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { string current = enumerator.Current; string[] array = current.Split(new char[] { '\t', '=' }, StringSplitOptions.RemoveEmptyEntries); if (array.Length > 1) { string text3 = array[0].Trim().ToLower(); string text4 = array[1].Trim().Replace("\"", ""); string key; switch (key = text3) { case "name": this.gh3SongInfo.title = text4; break; case "artist": this.gh3SongInfo.artist = text4; break; case "year": this.gh3SongInfo.year = text4; break; case "player2": this.gh3SongInfo.not_bass = !text4.ToLower().Equals("bass"); break; case "artisttext": if (text4.Equals("by")) { this.gh3SongInfo.artist_text = true; } else if (text4.Equals("as made famous by")) { this.gh3SongInfo.artist_text = false; } else { this.gh3SongInfo.artist_text = text4; } break; case "offset": this.gh3SongInfo.input_offset = (this.gh3SongInfo.gem_offset = Convert.ToInt32(Convert.ToDouble(text4) * -1000.0)); break; case "singer": this.gh3SongInfo.singer = text4; break; case "bassist": this.gh3SongInfo.bassist = text4; break; case "boss": this.gh3SongInfo.boss = text4; break; case "countoff": this.gh3SongInfo.countoff = text4; break; case "guitarvol": this.gh3SongInfo.guitar_vol = Convert.ToSingle(text4); break; case "bandvol": this.gh3SongInfo.band_vol = Convert.ToSingle(text4); break; case "hopo": this.gh3SongInfo.hammer_on = Convert.ToSingle(text4); break; case "originalartist": this.gh3SongInfo.original_artist = text4.Equals("true"); break; case "resolution": ChartParser.resolution = 480.0 / Convert.ToDouble(text4); break; } } } goto IL_4D5; } goto IL_477; } if (!(a == "SyncTrack")) { if (!(a == "Events")) { goto IL_477; } if (this.sectionInterpreter == null) { this.sectionInterpreter = new SectionInterpreter(list.ToArray()); } } else if (this.bpmInterpreter == null) { this.bpmInterpreter = new BPMInterpreter(list.ToArray()); } IL_4D5: list.Clear(); continue; IL_477: Console.WriteLine(bracketItems + ", " + bracketItemsWithBrackets); if (this.difficultyWithNotes.ContainsKey(bracketItems)) { goto IL_4D5; } if (!bracketItems.Contains("Single") && !bracketItems.Contains("Double")) { this.instrumentList.Add(bracketItems, new InstrumentType(list.ToArray())); goto IL_4D5; } this.difficultyWithNotes.Add(bracketItems, new NoteEventInterpreter(list.ToArray(), this.constant480)); goto IL_4D5; } else if (!bracketItemsWithBrackets.Equals("")) { list.Add(bracketItemsWithBrackets); } } } stringReader.Close(); this.removeEmptyParts(); }
public ChartParser method_0() { string name = ""; name = name + new FileInfo(this.fileLocation).Name + ":\n"; try { this.midiReader = MIDIReader.smethod_0(this.fileLocation); } catch (Exception) { throw new IOException(name + "Unknown Error: Could not parse MIDI sequence."); } foreach (MIDILine current in this.midiReader.getMidiLineList()) { if (current.method_2().Equals("PART GUITAR")) { this.isPartGuitar = true; } else if (current.method_2().Equals("EVENTS")) { this.isEvents = true; } } if (this.midiReader.getMidiLineList().Count == 1 && !this.isPartGuitar) { this.midiReader.getMidiLineList()[0].method_3("PART GUITAR"); this.isPartGuitar = true; } if (!this.isPartGuitar) { throw new IOException(name + "PART GUITAR not found. No chart created."); } ChartParser chartParser = new ChartParser(); this.bpmInterpreter = chartParser.bpmInterpreter; this.sectionInterpreter = chartParser.sectionInterpreter; chartParser.difficultyWithNotes.Add("EasySingle", this.easySingle); chartParser.difficultyWithNotes.Add("MediumSingle", this.mediumSingle); chartParser.difficultyWithNotes.Add("HardSingle", this.hardSingle); chartParser.difficultyWithNotes.Add("ExpertSingle", this.expertSingle); chartParser.difficultyWithNotes.Add("EasyDoubleGuitar", this.easyDoubleGuitar); chartParser.difficultyWithNotes.Add("MediumDoubleGuitar", this.mediumDoubleGuitar); chartParser.difficultyWithNotes.Add("HardDoubleGuitar", this.hardDoubleGuitar); chartParser.difficultyWithNotes.Add("ExpertDoubleGuitar", this.expertDoubleGuitar); chartParser.difficultyWithNotes.Add("EasyDoubleBass", this.easyDoubleBass); chartParser.difficultyWithNotes.Add("MediumDoubleBass", this.mediumDoubleBass); chartParser.difficultyWithNotes.Add("HardDoubleBass", this.hardDoubleBass); chartParser.difficultyWithNotes.Add("ExpertDoubleBass", this.expertDoubleBass); chartParser.instrumentList.Add("EasyDrums", this.easyDrums); chartParser.instrumentList.Add("MediumDrums", this.mediumDrums); chartParser.instrumentList.Add("HardDrums", this.hardDrums); chartParser.instrumentList.Add("ExpertDrums", this.expertDrums); chartParser.instrumentList.Add("EasyKeyboard", this.easyKeyboard); chartParser.instrumentList.Add("MediumKeyboard", this.mediumKeyboard); chartParser.instrumentList.Add("HardKeyboard", this.hardKeyboard); chartParser.instrumentList.Add("ExpertKeyboard", this.expertKeyboard); chartParser.constant480 = 480; this.resolution = 480.0 / (double)this.midiReader.method_0(); object obj = name; name = string.Concat(new object[] { obj, "NumTracks = ", this.midiReader.getMidiLineList().Count, "\n" }); this.method_1(this.midiReader.getMidiLineList()[0]); foreach (MIDILine midiLine in this.midiReader.getMidiLineList()) { if (midiLine.method_2().Equals("PART GUITAR")) { this.getNotes(midiLine, 0); } else if (midiLine.method_2().Equals("T1 GEMS")) { this.getNotes(midiLine, 0); } else if (midiLine.method_2().Equals("PART GUITAR COOP")) { this.getNotes(midiLine, 1); } else if (midiLine.method_2().Equals("PART RHYTHM")) { this.notBass = true; this.getNotes(midiLine, 3); } else if (midiLine.method_2().Equals("PART BASS")) { this.getNotes(midiLine, 3); } else if (midiLine.method_2().Equals("EVENTS")) { this.getNotes(midiLine, 4); } else if (midiLine.method_2().Equals("BAND DRUMS")) { this.getNotes(midiLine, 5); } else if (midiLine.method_2().Equals("BAND KEYS")) { this.getNotes(midiLine, 7); } else { name = name + "Track (" + midiLine.method_2() + ") ignored.\n"; } } chartParser.gh3SongInfo.title = this.songTitle; chartParser.gh3SongInfo.not_bass = this.notBass; name += "Conversion Complete!"; Console.WriteLine(name); chartParser.removeEmptyParts(); return chartParser; }
public ChartParser() { this.bpmInterpreter = new BPMInterpreter(); this.sectionInterpreter = new SectionInterpreter(); }