public static QBCParser getMidiSong(string fileName, bool forceRB3) { QBCParser qbc = null; Song song = null; try { song = MidReader.ReadMidi(fileName); String chartFile = ChartWriter.writeChart(song, "", false, forceRB3).ToString(); ChartParser chartParser = new ChartParser(chartFile, false); qbc = chartParser.method_3(); } catch(Exception e) { MessageBox.Show("Error using the new MIDI import method.\nReverting to original GHTCP method. \n\n" + e.ToString(), "MIDI Error", MessageBoxButtons.OK, MessageBoxIcon.Information); qbc = new MIDIParser(fileName).method_0().method_3(); } return qbc; }
public ChartParser method_2(GH3Song gh3Song_1) { ChartParser @class = new ChartParser(this.gh3Song_0); @class.constant480 = this.int_1; if (gh3Song_1 != null) { @class.gh3SongInfo.vmethod_0(gh3Song_1); } this.class228_6 = new Track<int, int>(); if (this.class239_0 != null) { int value = this.class239_0[0]; this.class239_0[0] = 0; int num = 0; for (int i = 1; i < this.class239_0.Count; i++) { int num2 = this.class239_0[i] - this.class239_0[i - 1]; int num3 = Convert.ToInt32(60000000.0 / (double)num2); if (num3 != num) { @class.bpmInterpreter.bpmList.Add((i - 1) * this.int_1, num3); num = num3; } this.class228_6.Add(this.class239_0[i - 1], num2); } this.class239_0[0] = value; @class.sectionInterpreter.otherList.Add(this.method_0(this.class239_0[this.class239_0.Count - 1]), new List<string>(new string[] { "end" })); foreach (int current in this.class228_1.Keys) { @class.sectionInterpreter.sectionList.Add(this.method_0(current), this.class228_1[current]); } foreach (int current2 in this.tsList.Keys) { @class.bpmInterpreter.TSList.Add(this.method_0(current2), this.tsList[current2][0]); } Track<int, int> class2 = new Track<int, int>(); Track<int, int> class3 = new Track<int, int>(); foreach (int current3 in this.class228_2.Keys) { int num4 = this.method_0(current3); int num5 = this.method_0(current3 + this.class228_2[current3] - this.int_0) - num4; class2.Add(num4, (num5 <= this.int_1 / 4) ? 0 : num5); } foreach (int current4 in this.class228_3.Keys) { int num4 = this.method_0(current4); int num5 = this.method_0(current4 + this.class228_3[current4] - this.int_0) - num4; class3.Add(num4, (num5 <= this.int_1 / 4) ? 0 : num5); } Track<int, int> class4 = new Track<int, int>(); Track<int, int> class5 = new Track<int, int>(); foreach (int current5 in this.bpmList.Keys) { int num4 = this.method_0(current5); int num5 = this.method_0(current5 + this.bpmList[current5] - this.int_0) - num4; class4.Add(num4, (num5 <= this.int_1 / 4) ? 0 : num5); } foreach (int current6 in this.class228_5.Keys) { int num4 = this.method_0(current6); int num5 = this.method_0(current6 + this.class228_5[current6] - this.int_0) - num4; class5.Add(num4, (num5 <= this.int_1 / 4) ? 0 : num5); } string[] array = new string[] { "Easy", "Medium", "Hard", "Expert" }; string[] array2 = new string[] { "Single", "Double" }; for (int j = 0; j < array2.Length; j++) { string text = array2[j]; string[] array3 = new string[] { "Guitar", "Rhythm" }; for (int k = 0; k < array3.Length; k++) { string text2 = array3[k]; string[] array4 = array; for (int l = 0; l < array4.Length; l++) { string text3 = array4[l]; string key = (text2.ToLower() + ((text == "Double") ? "coop" : "") + "_" + text3.ToLower()).Replace("guitar_", ""); if (this.noteList.ContainsKey(key)) { NoteEventInterpreter class6 = new NoteEventInterpreter(); Track<int, NotesAtOffset> class7 = this.noteList[key]; foreach (int current7 in class7.Keys) { int num4 = this.method_0(current7); int num5 = this.method_0(current7 + class7[current7].sustainLength - this.int_0) - num4; class6.noteList.Add(num4, new NotesAtOffset(class7[current7].noteValues, (num5 <= this.int_1 / 4) ? 0 : num5)); } class6.alwaysTrue = false; if (this.spList.ContainsKey(key)) { Track<int, int[]> class8 = this.spList[key]; foreach (int current8 in class8.Keys) { int num4 = this.method_0(current8); int num5 = this.method_0(current8 + class8[current8][0] - this.int_0) - num4; class6.class228_1.Add(num4, (num5 <= this.int_1 / 4) ? 0 : num5); } } if (this.battleNoteList.ContainsKey(key)) { Track<int, int[]> class9 = this.spList[key]; foreach (int current9 in class9.Keys) { int num4 = this.method_0(current9); int num5 = this.method_0(current9 + class9[current9][0] - this.int_0) - num4; class6.class228_4.Add(num4, (num5 <= this.int_1 / 4) ? 0 : num5); } } class6.class228_2 = class2; class6.class228_3 = class3; class6.class228_5 = class4; class6.class228_6 = class5; @class.difficultyWithNotes.Add(text3 + text + text2, class6); } } } } this.class228_6.Clear(); this.class228_6 = null; return @class; } return null; }
private void LoadChart_EditorBtn_Click(object sender, EventArgs e) { string fileName; if (!(fileName = KeyGenerator.OpenOrSaveFile("Select the game track file.", "Any Supported Game Track Formats|*.qbc;*.dbc;*_song.pak.xen;*.mid;*.chart|GH3CP QB Based Chart File|*.qbc|GH3CP dB Based Chart File|*.dbc|GH3 Game Track file|*_song.pak.xen|GH standard Midi file|*.mid|dB standard or GH3CP Chart file|*.chart", true)).Equals("")) { QBCParser qbcParser; try { if (fileName.EndsWith("_song.pak.xen")) { string str = KeyGenerator.GetFileName(fileName).Replace("_song.pak.xen", ""); using (zzPakNode2 @class = new zzPakNode2(fileName, false)) { if ([email protected]_6("songs\\" + str + ".mid.qb")) { throw new Exception("MID.QB song file not found."); } qbcParser = new QBCParser(str, @class.zzGetNode1("songs\\" + str + ".mid.qb")); goto IL_DA; } } if (fileName.EndsWith(".qbc")) { qbcParser = new QBCParser(fileName); } else if (fileName.EndsWith(".mid")) { qbcParser = Midi2Chart.getMidiSong(fileName, this.forceRB3MidConversionToolStripMenuItem.Checked); } else { qbcParser = new ChartParser(fileName).method_3(); } IL_DA:; } catch (Exception ex) { MessageBox.Show("Error loading game track file!\n" + ex.Message); return; } this.SongName_EditorLbl.Text = qbcParser.gh3Song_0.title; this.SelectedTrack_EditorBox.Items.Clear(); foreach (string current in qbcParser.noteList.Keys) { this.SelectedTrack_EditorBox.Items.Add(current); } this.SongEditor_Control.method_11(qbcParser); this.SelectedTrack_EditorBox.SelectedIndex = 0; this.Offset_EditorTxtBox.Text = string.Concat(qbcParser.gh3Song_0.gem_offset); } }
private void MassImporter_MenuItem_Click(object sender, EventArgs e) { FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog(); folderBrowserDialog.ShowNewFolderButton = false; folderBrowserDialog.Description = "Please select a folder that contains the folder structure for mass song importing."; folderBrowserDialog.RootFolder = Environment.SpecialFolder.DesktopDirectory; if (folderBrowserDialog.ShowDialog() != DialogResult.OK) { return; } string[] directories = Directory.GetDirectories(folderBrowserDialog.SelectedPath, "*", SearchOption.TopDirectoryOnly); List<string> list = new List<string>(directories); string[] array = directories; for (int i = 0; i < array.Length; i++) { string file = array[i]; try { List<string> list2 = KeyGenerator.checkFile(file, "*.mid;*.chart;*.qbc;*.dbc", true); List<string> list3 = KeyGenerator.checkFile(file, "*.wav;*.mp3;*.ogg", true); string[] files = Directory.GetFiles(file, "*.dat", SearchOption.TopDirectoryOnly); if (list2.Count != 0 && (list3.Count != 0 || files.Length != 0)) { GH3Song gH3Song = this.bool_0 ? new GHASong() : new GH3Song(); gH3Song.name = KeyGenerator.GetFileName(file).ToLower().Replace(" ", "").Replace('.', '_'); if (gH3Song.name.Length > 30) { gH3Song.name = gH3Song.name.Remove(30); } if (QbSongClass1.smethod_4(gH3Song.name) || this.gh3Songlist_0.method_3(gH3Song.name)) { int num = 2; while (QbSongClass1.smethod_4(gH3Song.name + num) || this.gh3Songlist_0.method_3(gH3Song.name + num)) { num++; } GH3Song expr_176 = gH3Song; expr_176.name += num; } QBCParser qbcParser = null; foreach (string current in list2) { try { if (current.EndsWith(".qbc")) { qbcParser = new QBCParser(current); } else if (current.EndsWith(".mid")) { qbcParser = Midi2Chart.getMidiSong(current, this.forceRB3MidConversionToolStripMenuItem.Checked); } else { qbcParser = new ChartParser(current).method_3(); } break; } catch { } } if (qbcParser != null) { zzQbSongObject class2 = null; if (files.Length != 0) { string[] array2 = files; for (int j = 0; j < array2.Length; j++) { string text2 = array2[j]; try { if (File.Exists(text2.Replace(".dat.xen", ".fsb.xen"))) { class2 = new zzQbSongObject(text2); if ((int)new FileInfo(text2.Replace(".dat.xen", ".fsb.xen")).Length == class2.int_0) { break; } } } catch { } } } if (class2 != null || list3.Count != 0) { SongData songData = new SongData(gH3Song.name, qbcParser, class2, list3.ToArray()); Class250 class3 = songData.method_1(this.class319_0, this.dataFolder); Class248 class4 = songData.method_0(this.dataFolder); gH3Song.vmethod_0(class3.class362_0.gh3Song_0); if (File.Exists(file + "\\song.ini")) { string[] array3 = File.ReadAllLines(file + "\\song.ini"); for (int k = 0; k < array3.Length; k++) { string text3 = array3[k]; if (text3.StartsWith("name")) { gH3Song.title = text3.Remove(0, text3.IndexOf('=') + 1).Trim(); } else if (text3.StartsWith("artist")) { gH3Song.artist = text3.Remove(0, text3.IndexOf('=') + 1).Trim(); } } } gH3Song.no_rhythm_track = !class4.bool_0; gH3Song.use_coop_notetracks = class4.bool_1; gH3Song.version = 3; gH3Song.leaderboard = true; gH3Song.editable = true; this.method_4(class3); this.method_4(class4); this.gh3Songlist_0.Add(gH3Song.name, gH3Song); list.Remove(file); } } } } catch { } } this.method_4(new Class247(this.class319_0, this.gh3Songlist_0)); this.method_0(); if (list.Count != 0) { string text4 = "The follwing songs (by folder name) failed:"; foreach (string current2 in list) { text4 = text4 + "\n" + KeyGenerator.GetFileName(current2); } MessageBox.Show(text4, "Error!"); } }
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; }