public void SetSelectedSongItem(SongCacheItem sc) { trackEditorG5.ViewLyrics = settings.GetValueBool("View Lyrics in G5 Editor", true); CloseG5Track(); CloseProTrack(); if (sc != null) { SelectedSong = sc; var i = SongList.IndexOf(sc); SongList.SelectedSong = sc; settings.SetValue("lastSelectedSongItem", sc.ToString()); label37.Text = sc.SongName; textBoxSongLibG5MidiFileName.SetValueSuspend(sc.G5FileName).ScrollToEnd(); textBoxSongLibProMidiFileName.SetValueSuspend(sc.G6FileName).ScrollToEnd(); textBoxSongLibConFile.SetValueSuspend(sc.G6ConFile).ScrollToEnd(); textBox24.SetValueSuspend(sc.Description).ScrollToEnd(); checkBoxSongLibHasBass.SetValueSuspend(sc.HasBass); checkBoxSongLibHasGuitar.SetValueSuspend(sc.HasGuitar); checkBoxSongLibCopyGuitar.SetValueSuspend(sc.CopyGuitarToBass); checkBoxSongLibIsComplete.SetValueSuspend(sc.IsComplete); checkBoxSongLibIsFinalized.SetValueSuspend(sc.IsFinalized); textBox37.SetValueSuspend(sc.GuitarTuning[0]); textBox38.SetValueSuspend(sc.GuitarTuning[1]); textBox39.SetValueSuspend(sc.GuitarTuning[2]); textBox40.SetValueSuspend(sc.GuitarTuning[3]); textBox41.SetValueSuspend(sc.GuitarTuning[4]); textBox42.SetValueSuspend(sc.GuitarTuning[5]); textBox43.SetValueSuspend(sc.BassTuning[0]); textBox44.SetValueSuspend(sc.BassTuning[1]); textBox45.SetValueSuspend(sc.BassTuning[2]); textBox46.SetValueSuspend(sc.BassTuning[3]); textBox47.SetValueSuspend(sc.BassTuning[4]); textBox48.SetValueSuspend(sc.BassTuning[5]); comboProBDifficulty.SetValueSuspend(sc.DTABassDifficulty); comboProGDifficulty.SetValueSuspend(sc.DTAGuitarDifficulty); textBoxCONSongID.SetValueSuspend(sc.DTASongID); textBoxCONShortName.SetValueSuspend(sc.DTASongShortName); FileNameG5 = sc.G5FileName; FileNamePro = sc.G6FileName; textBoxSongPropertiesMP3StartOffset.SetValueSuspend(sc.SongMP3PlaybackOffset.ToStringEx()); textBoxSongPropertiesMP3Location.SetValueSuspend(sc.SongMP3Location).ScrollToEnd(); if (mp3Player.PlayingMP3File) { mp3Player.Stop(); } this.trackBarMidiVolume.SetValueSuspend(sc.SongMidiPlaybackVolume); this.trackBarMP3Volume.SetValueSuspend(sc.SongMP3PlaybackVolume); checkBoxEnableMidiPlayback.SetValueSuspend(sc.EnableSongMidiPlayback); checkBoxSongPropertiesEnableMP3Playback.SetValueSuspend(sc.EnableSongMP3Playback); enableMidiPlayback(checkBoxEnableMidiPlayback.Checked); enableMP3Playback(checkBoxSongPropertiesEnableMP3Playback.Checked); ApplyMidiVolumeChange(sc.SongMidiPlaybackVolume); ApplyMP3VolumeChange(sc.SongMP3PlaybackVolume); checkBoxAutoGenGuitarHard.SetValueSuspend(sc.AutoGenGuitarHard); checkBoxAutoGenGuitarMedium.SetValueSuspend(sc.AutoGenGuitarMedium); checkBoxAutoGenGuitarEasy.SetValueSuspend(sc.AutoGenGuitarEasy); checkBoxAutoGenBassHard.SetValueSuspend(sc.AutoGenBassHard); checkBoxAutoGenBassMedium.SetValueSuspend(sc.AutoGenBassMedium); checkBoxAutoGenBassEasy.SetValueSuspend(sc.AutoGenBassEasy); RefreshTracks(); } else if (SelectedSong != null) { SelectedSong = null; SongList.SelectedSong = null; PUEExtensions.TryExec(delegate() { if (mp3Player.PlayingMP3File) { mp3Player.Stop(); } }); listBoxSongLibrary.SelectedItems.Clear(); label37.Text = "None Selected"; textBoxSongLibG5MidiFileName.Text = ""; textBoxSongLibProMidiFileName.Text = ""; textBoxSongLibConFile.Text = ""; textBox24.Text = ""; checkBoxSongLibHasBass.Checked = false; checkBoxSongLibHasGuitar.Checked = false; checkBoxSongLibCopyGuitar.Checked = false; checkBoxSongLibIsComplete.Checked = false; checkBoxSongLibIsFinalized.Checked = false; textBox37.Text = ""; textBox38.Text = ""; textBox39.Text = ""; textBox40.Text = ""; textBox41.Text = ""; textBox42.Text = ""; textBox43.Text = ""; textBox44.Text = ""; textBox45.Text = ""; textBox46.Text = ""; textBox47.Text = ""; textBox48.Text = ""; comboProBDifficulty.SelectedIndex = 0; comboProGDifficulty.SelectedIndex = 0; textBoxCONSongID.Text = ""; textBoxCONShortName.Text = ""; FileNameG5 = ""; FileNamePro = ""; textBoxSongPropertiesMP3Location.Text = ""; if (settings.GetValueBool("Keep Midi Playback Selection", false) == false) { textBoxSongPropertiesMP3StartOffset.Text = ""; checkBoxSongPropertiesEnableMP3Playback.Checked = false; checkBoxEnableMidiPlayback.Checked = true; this.trackBarMidiVolume.Value = 100; this.trackBarMP3Volume.Value = 100; } if (settings.GetValueBool("Keep Auto Gen Difficulty Selection", false) == false) { checkBoxAutoGenGuitarHard.Checked = false; checkBoxAutoGenGuitarMedium.Checked = false; checkBoxAutoGenGuitarEasy.Checked = false; checkBoxAutoGenBassHard.Checked = false; checkBoxAutoGenBassMedium.Checked = false; checkBoxAutoGenBassEasy.Checked = false; } RefreshTracks(); } }
public bool CheckCONPackageDTA(SongCacheItem item, bool silent) { bool ret = false; if (item == null) return ret; List<string> fileErrors = new List<string>(); try { if (string.IsNullOrEmpty(item.G6FileName)) { fileErrors.Add("Guitar Midi file name missing"); } if (string.IsNullOrEmpty(item.G6ConFile)) { fileErrors.Add("Missing CON File"); } else { var pk = Package.Load(ReadFileBytes(item.G6ConFile)); CheckConPackage(pk, ref fileErrors, item); } } catch (Exception ex) { if (silent) { WriteBatchResult("Unhandled exception processing: " + item.ToString()); } else { MessageBox.Show("Unhandled exception : " + ex.Message); } } if (fileErrors.Count > 0) { if (silent) { WriteBatchResult("Errors in - " + item.ToString()); } } else { ret = true; } var sb = new StringBuilder(); foreach (string s in fileErrors) { if (silent) { WriteBatchResult(s); } else { sb.AppendLine(s); } } RefreshTracks(); if (!silent) { if (fileErrors.Count > 0) { OpenNotepad(Encoding.ASCII.GetBytes(sb.ToString())); } else { MessageBox.Show("Check OK"); } } return ret; }