private void listBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Left || e.Key == Key.Right || e.Key == Key.Up || e.Key == Key.Down) { SoundClass.PlayPS4Sound(SoundClass.Sound.Navigation); } }
private void listBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { using (FileStream isoStream = File.OpenRead(MainWindow.pspfiles[listBox.SelectedIndex].ToString())) { //use disk utils to read iso quickly CDReader cd = new CDReader(isoStream, true); //look for the spesific file Stream fileStream = cd.OpenFile(@"SYSTEM.CNF", FileMode.Open); // Use fileStream... TextReader tr = new StreamReader(fileStream); string fullstring = tr.ReadToEnd();//read string to end this will read all the info we need //mine for info string Is = @"\"; string Ie = ";"; //mine the start and end of the string int start = fullstring.ToString().IndexOf(Is) + Is.Length; int end = fullstring.ToString().IndexOf(Ie, start); if (end > start) { string PS2Id = fullstring.ToString().Substring(start, end - start); if (PS2Id != string.Empty) { lblTitleId.Content = PS2Id.Replace(".", "").Replace("_", ""); } else { System.Windows.Forms.MessageBox.Show("Could not load PS2 ID"); } } else { System.Windows.Forms.DialogResult dlr = System.Windows.Forms.MessageBox.Show("Could not load PS2 ID\n\n wpuld you like to submit an issue ?", "Error Reporting", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question, System.Windows.Forms.MessageBoxDefaultButton.Button2); if (dlr == System.Windows.Forms.DialogResult.Yes) { //load github issue page Process.Start(@"https://github.com/xXxTheDarkprogramerxXx/PS3Tools/issues"); } } } SoundClass.PlayPS4Sound(SoundClass.Sound.Navigation); } catch (Exception ex) { } }
public MessageBox(string Text, string Caption, PS4_MessageBoxButton _Buttons, SoundClass.Sound SoundToPlay) { InitializeComponent(); lblTitle.Content = Caption; Buttons = _Buttons; txtErrorMessage.Text = Text; switch (Buttons) { case PS4_MessageBoxButton.OK: { btnPositive.Visibility = Visibility.Visible; btnPositive.Content = "OK"; btnPositive.Click += BtnPositive_Click; } break; case PS4_MessageBoxButton.YesNo: { btnPositive.Visibility = Visibility.Visible; btnPositive.Content = "Yes"; btnPositive.Click += BtnPositive_Click; btnNegative.Visibility = Visibility.Visible; btnNegative.Content = "No"; btnNegative.Click += BtnNegative_Click;; } break; case PS4_MessageBoxButton.OKCancel: { btnPositive.Visibility = Visibility.Visible; btnPositive.Content = "OK"; btnPositive.Click += BtnPositive_Click; btnNegative.Visibility = Visibility.Visible; btnNegative.Content = "Cancel"; btnNegative.Click += BtnNegative_Click; } break; default: break; } SoundClass.PlayPS4Sound(SoundToPlay); }
public void DoSettings() { //check control type if (Values[listBox.SelectedIndex].type != new Control()) { ListViewItem lvi = listView.SelectedValue as ListViewItem; Values[listBox.SelectedIndex].SValue = lvi.Content.ToString(); if (Values[listBox.SelectedIndex].SValue == "On") { switch (Values[listBox.SelectedIndex].SettingName) { case "Overwrite Temp Folder": Properties.Settings.Default.OverwriteTemp = true; break; case "Replace NP Title ID With PS2 Title ID": Properties.Settings.Default.EnablePSPIDReplace = true; break; case "Enable Boot Logo": Properties.Settings.Default.EnableBootScreen = true; break; case "Enable PS4 Ambient Music": Properties.Settings.Default.EnableGuiMusic = true; SoundClass.PlayPS4Sound(SoundClass.Sound.PS4_Music); break; case "Enable PSP PMF + AT3": MessageBox ps4mes = new MessageBox("To Allow this feature an external download is needed \nWould you like to continue ?", "Download", PS4_MessageBoxButton.YesNo, SoundClass.Sound.Notification); ps4mes.ShowDialog(); if (PS4_MessageBoxResult.Yes == MessageBox.ReturnResult) { bgWorkerSS.RunWorkerAsync(); startDownload(); } break; case "Enable PSP UI": Properties.Settings.Default.EnablePSPMode = true; ps4mes = new MessageBox("Please Restart The Application to enable settings", "Done", PS4_MessageBoxButton.OK, SoundClass.Sound.Notification); ps4mes.ShowDialog(); break; case "Enable Mysis Patch": Properties.Settings.Default.EnableMysisPatch = true; break; } Properties.Settings.Default.Save();//save the settings } else { switch (Values[listBox.SelectedIndex].SettingName) { case "Overwrite Temp Folder": Properties.Settings.Default.OverwriteTemp = false; break; case "Replace NP Title ID With PS2 Title ID": Properties.Settings.Default.EnablePSPIDReplace = false; break; case "Enable Boot Logo": Properties.Settings.Default.EnableBootScreen = false; break; case "Enable PS4 Ambient Music": Properties.Settings.Default.EnableGuiMusic = false; if (SoundClass.PS4BGMDevice != null) { SoundClass.PS4BGMDevice.Stop(); } break; case "Enable PSP PMF + AT3": Properties.Settings.Default.EnablePMF = false; break; case "Enable PSP UI": Properties.Settings.Default.EnablePSPMode = false; break; case "Enable Mysis Patch": Properties.Settings.Default.EnableMysisPatch = false; break; } Properties.Settings.Default.Save();//save the settings } } else { using (var dialog = new System.Windows.Forms.FolderBrowserDialog()) { System.Windows.Forms.DialogResult result = dialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { Properties.Settings.Default.TempPath = dialog.SelectedPath.ToString(); } Values[listBox.SelectedIndex].SValue = Properties.Settings.Default.TempPath; } Properties.Settings.Default.Save();//save the settings } //close the options pannel MainWindowView.Opacity = 1.0f; OptionsView.Visibility = Visibility.Hidden; listBox.Background = System.Windows.Media.Brushes.Transparent; ClearAndAddList(); }