public MainWindow() { _ConfigFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + "\\"; _ConfigName = _ConfigFolder + _ConfigName; _ConfigStore = _ConfigFolder + "PSPStore\\"; try { _ConfigDefault.Load(File.ReadAllBytes(_ConfigName)); } catch { File.Delete(_ConfigName); } if (!File.Exists(_ConfigName)) { _ConfigDefault.Param("X", "0"); _ConfigDefault.Param("Y", "0"); _ConfigDefault.Param("Width", "1050"); _ConfigDefault.Param("Height", "687"); _ConfigDefault.Param("WidthCatalog", "80"); _ConfigDefault.Param("WidthName", "120"); _ConfigDefault.Param("WidthLaguage", "80"); _ConfigDefault.Param("WidthFirmware", "80"); _ConfigDefault.Param("Mode", 0); _ConfigDefault.Param("State", 0); _ConfigDefault.Param("PSPGame", "Select PSP Games Directory."); _ConfigDefault.SaveAs(_ConfigName); } if (Double.Parse(_ConfigDefault.Param("X")) == 0 && Double.Parse(_ConfigDefault.Param("Y")) == 0) { this.WindowStartupLocation = WindowStartupLocation.CenterScreen; } else { this.Top = Double.Parse(_ConfigDefault.Param("Y")); this.Left = Double.Parse(_ConfigDefault.Param("X")); } this.Width = Double.Parse(_ConfigDefault.Param("Width")); this.Height = Double.Parse(_ConfigDefault.Param("Height")); WindowState configState = System.Windows.WindowState.Normal; if (Int32.Parse(_ConfigDefault.Param("State")) == 1) { configState = System.Windows.WindowState.Maximized; } this.WindowState = configState; InitializeComponent(); }
void SavingSFAFile(Item edit) { String GameDataFile = _DataDriectory + "\\GAME.SFO"; try { SfoFile GameSFO = new SfoFile(); GameSFO.Load(File.ReadAllBytes(GameDataFile)); GameSFO.Param("RELEASE", edit.Detail.Release); GameSFO.Param("PLAYERS", edit.Detail.Player); GameSFO.Param("GENRE", edit.Detail.Genre); GameSFO.Param("DEVELOPER", edit.Detail.Developer); GameSFO.Param("PUBLISHER", edit.Detail.Publisher); GameSFO.Param("DESCRIPTION", edit.Detail.Description); GameSFO.SaveAs(_DataDriectory + "\\GAME.SFO"); } catch (IOException ex) { MessageBox.Show(ex.Message, "SavingSFAFile()", MessageBoxButton.OK, MessageBoxImage.Exclamation); } // Update Thread Console.WriteLine("Complated Saved."); this.Dispatcher.BeginInvoke(new LibrarySaveMethod(SavedSFAFile), DispatcherPriority.Normal, null); }
private void ButtonApply_Click(object sender, RoutedEventArgs e) { this.Reload = false; if (Directory.Exists(txtBrowse.Text.Trim()) && _ConfigDefault.Param("PSPGame") != txtBrowse.Text.Trim()) { this.Reload = true; _ConfigDefault.Param("PSPGame", txtBrowse.Text.Trim()); } _ConfigDefault.SaveAs(_ConfigFolder + _ConfigName); this.Viewed = false; this.Hide(); }
void SavingSFAFile(Item edit) { String GameDataFile = _DataDriectory + "\\GAME.SFO"; try { SfoFile GameSFO = new SfoFile(); GameSFO.Load(File.ReadAllBytes(GameDataFile)); GameSFO.Param("RELEASE", edit.Detail.Release); GameSFO.Param("PLAYERS", edit.Detail.Player); GameSFO.Param("GENRE", edit.Detail.Genre); GameSFO.Param("DEVELOPER", edit.Detail.Developer); GameSFO.Param("PUBLISHER", edit.Detail.Publisher); GameSFO.Param("DESCRIPTION", edit.Detail.Description); GameSFO.SaveAs(_DataDriectory + "\\GAME.SFO"); } catch (IOException ex) { MessageBox.Show(ex.Message, "SavingSFAFile()", MessageBoxButton.OK, MessageBoxImage.Exclamation); } // Update Thread Console.WriteLine("Complated Saved."); this.Dispatcher.BeginInvoke(new LibrarySaveMethod(SavedSFAFile), DispatcherPriority.Normal, null); }