Inheritance: INotifyPropertyChanged
 private void Setup()
 {
     this.g = (Game) base.Tag;
     this.pcsx2_ini = new IniFile(Path.Combine(UserSettings.ConfigDir, this.g.FileSafeTitle) + @"\PCSX2Bonus.ini");
     this.lbVersions.Items.Add(Path.GetFileNameWithoutExtension(this.pcsx2_ini.Read("Additional Executables", "Default")));
     this.original = this.pcsx2_ini.Read("Additional Executables", "Default");
 }
Exemple #2
0
 private static void SetCoverArt(Game g)
 {
     Microsoft.Win32.OpenFileDialog dialog = new Microsoft.Win32.OpenFileDialog {
         Filter = "Image Files | *.jpg; *.png; *.gif; *.bmp"
     };
     if (dialog.ShowDialog() == true)
     {
         try
         {
             string[] strArray = new string[] { ".jpg", ".png", ".gif", ".bmp" };
             string str = Path.Combine(UserSettings.ImageDir, g.Title.CleanFileName());
             string destFileName = Path.Combine(UserSettings.ImageDir, g.Title.CleanFileName() + Path.GetExtension(dialog.FileName));
             foreach (string str3 in strArray)
             {
                 if (System.IO.File.Exists(str + str3))
                 {
                     System.IO.File.Delete(str + str3);
                 }
             }
             System.IO.File.Copy(dialog.FileName, destFileName);
             g.ImagePath = destFileName;
         }
         catch (Exception exception)
         {
             Tools.ShowMessage("Error setting cover art: " + exception.Message, MessageType.Error);
         }
     }
 }
Exemple #3
0
 private void AddDummies()
 {
     int num = 500;
     for (int i = num; i < (num + 100); i++)
     {
         int result = 0;
         string str = GameManager.GameDatabase[i];
         string[] source = str.Trim().Split(new char[] { '\n' });
         string str2 = source.FirstOrDefault<string>(s => s.Contains("Compat"));
         if (!string.IsNullOrWhiteSpace(str2))
         {
             result = int.TryParse(str2.Replace("Compat = ", ""), out result) ? result : 0;
         }
         Game g = new Game {
             Serial = source[0],
             Title = source[1],
             Region = source[2],
             Description = "n/a*",
             Location = "",
             ImagePath = "",
             Compatibility = result
         };
         if (!Game.AllGames.Any<Game>(game => (game.Serial == g.Serial)))
         {
             GameManager.AddToLibrary(g);
         }
     }
 }
Exemple #4
0
 private static void GenerateExecutable(Game g)
 {
     wndGenerateExecutable executable = new wndGenerateExecutable {
         Tag = g
     };
     bool flag1 = executable.ShowDialog() == true;
 }
 private void Setup()
 {
     this.g = (Game) base.Tag;
     this.lbShaders.DisplayMemberPath = "Text";
     this.pcsx2_ini = new IniFile(Path.Combine(UserSettings.ConfigDir, this.g.FileSafeTitle) + @"\PCSX2Bonus.ini");
     foreach (string str in Directory.GetFiles(UserSettings.ShadersDir))
     {
         ListViewItem newItem = new ListViewItem {
             Content = str.FileNameNoExt(),
             Tag = str
         };
         this.lbShaders.Items.Add(newItem);
     }
 }
Exemple #6
0
 private void Setup()
 {
     this.g = (Game) base.Tag;
     base.Title = "Memory Card Management [" + this.g.Title + "]";
     this.pcsx2_ui = new IniFile(Path.Combine(UserSettings.ConfigDir, Path.Combine(this.g.FileSafeTitle, "PCSX2_ui.ini")));
     this.LoadInitialCard();
 }
 private void Setup()
 {
     this.g = (Game) base.Tag;
     this.pcsx2_ini = new IniFile(Path.Combine(UserSettings.ConfigDir, this.g.FileSafeTitle) + @"\PCSX2Bonus.ini");
     this.pcsx2_vm = new IniFile(Path.Combine(UserSettings.ConfigDir, Path.Combine(this.g.FileSafeTitle, "PCSX2_vm.ini")));
     this.pcsx2_ui = new IniFile(Path.Combine(UserSettings.ConfigDir, Path.Combine(this.g.FileSafeTitle, "PCSX2_ui.ini")));
     base.Title = "Viewing configuration for " + this.g.Title;
     this.UpdateSettings();
     this.LoadBios();
 }
 private void wndGenerateExecutable_Loaded(object sender, RoutedEventArgs e)
 {
     this.g = (Game) base.Tag;
     base.Title = string.Format("Generate Executable [{0}]", this.g.Title);
     this.Setup();
 }
Exemple #9
0
 public void LaunchGame(Game g, bool tvMode = false)
 {
     Process p;
     DateTime _timeOpened;
     string str = string.Empty;
     if (!File.Exists(g.Location))
     {
         Tools.ShowMessage("Unable to find image file!", MessageType.Error);
         if (tvMode)
         {
             Window window = System.Windows.Application.Current.Windows.Cast<Window>().FirstOrDefault<Window>(w => w.Title == "wndFullScreen");
             if (window != null)
             {
                 window.ShowDialog();
             }
         }
     }
     else
     {
         p = new Process();
         string path = UserSettings.RootDir + string.Format(@"\Configs\{0}", g.FileSafeTitle);
         if (Directory.Exists(path))
         {
             str = string.Format(" --cfgpath={0}{2}{0} {0}{1}{0}", "\"", g.Location, path);
         }
         else
         {
             str = string.Format(" {0}{1}{0}", "\"", g.Location);
         }
         str = str.Replace(@"\\", @"\");
         string src = string.Empty;
         string str4 = Settings.Default.pcsx2Dir;
         if (File.Exists(path + @"\PCSX2Bonus.ini"))
         {
             IniFile file = new IniFile(path + @"\PCSX2Bonus.ini");
             string str5 = file.Read("Additional Executables", "Default");
             string str6 = !str5.IsEmpty() ? str5 : Settings.Default.pcsx2Exe;
             str4 = !str5.IsEmpty() ? Path.GetDirectoryName(str5) : Settings.Default.pcsx2Dir;
             string str7 = file.Read("Boot", "NoGUI");
             string str8 = file.Read("Boot", "UseCD");
             string str9 = file.Read("Boot", "NoHacks");
             string str10 = file.Read("Boot", "FullBoot");
             src = file.Read("Shader", "Default");
             p.StartInfo.FileName = str6;
             if (str7 == "true")
             {
                 str = str.Insert(0, " --nogui");
             }
             if (str8 == "true")
             {
                 str = str.Insert(0, " --usecd");
             }
             if (str9 == "true")
             {
                 str = str.Insert(0, " --nohacks");
             }
             if (str10 == "true")
             {
                 str = str.Insert(0, " --fullboot");
             }
         }
         else
         {
             p.StartInfo.FileName = Settings.Default.pcsx2Exe;
         }
         p.EnableRaisingEvents = true;
         p.StartInfo.WorkingDirectory = str4;
         p.StartInfo.Arguments = str;
         if (!src.IsEmpty())
         {
             try
             {
                 File.Copy(src, Path.Combine(str4, "shader.fx"), true);
             }
             catch (Exception exception)
             {
                 Tools.ShowMessage("Could not save shader file! Details: " + exception.Message, MessageType.Error);
             }
         }
         _timeOpened = DateTime.Now;
         p.Exited += delegate (object o, EventArgs e) {
             if (p != null)
             {
                 p.Dispose();
             }
             System.Windows.Application.Current.Dispatcher.Invoke(delegate {
                 DateTime now = DateTime.Now;
                 g.TimePlayed = g.TimePlayed.Add(now.Subtract(_timeOpened));
                 XElement element = UserSettings.xGames.Descendants("Game").FirstOrDefault<XElement>(x => x.Element("Name").Value == g.Title);
                 if ((element != null) && (element.Element("Time") != null))
                 {
                     element.Element("Time").Value = g.TimePlayed.ToString();
                 }
                 if (tvMode)
                 {
                     Window window = System.Windows.Application.Current.Windows.Cast<Window>().FirstOrDefault<Window>(w => w.Title == "wndFullScreen");
                     if (window != null)
                     {
                         window.ShowDialog();
                     }
                 }
                 this._notifyIcon.Visible = false;
                 this.Show();
                 this.Activate();
             });
         };
         base.Hide();
         if (Settings.Default.enableGameToast)
         {
             new wndGameNotify { Tag = g }.Show();
         }
         this._notifyIcon.Text = string.Format("Currently playing [{0}]", g.Title.Truncate(40));
         this._notifyIcon.Visible = true;
         p.Start();
     }
 }
 private async void wndScreenshots_Loaded(object sender, RoutedEventArgs e)
 {
     this.g = (Game) this.Tag;
     this.Title = "Viewing screenshots for " + ((Game) this.Tag).Title;
     this.imgBig.MouseDown += new MouseButtonEventHandler(this.imgBig_MouseDown);
     Toaster.Instance.ShowToast("Loading screenshots");
     List<string> imageLinks = await GameManager.FetchScreenshots((Game) this.Tag);
     if (imageLinks.Count == 0)
     {
         this.Close();
     }
     else
     {
         try
         {
             List<string>.Enumerator enumerator = imageLinks.GetEnumerator();
             try
             {
                 while (enumerator.MoveNext())
                 {
                     string current = enumerator.Current;
                     if (File.Exists(current))
                     {
                         using (FileStream stream = File.OpenRead(current))
                         {
                             BitmapImage item = new BitmapImage();
                             item.BeginInit();
                             item.StreamSource = stream;
                             item.CacheOption = BitmapCacheOption.OnLoad;
                             item.EndInit();
                             this._imageLinks.Add(item);
                             continue;
                         }
                     }
                     BitmapImage bmi = await Tools.ImageFromWeb(current, this.cts.Token);
                     this._imageLinks.Add(bmi);
                 }
             }
             finally
             {
                 enumerator.Dispose();
             }
         }
         catch
         {
         }
         Toaster.Instance.HideToast();
     }
 }
Exemple #11
0
 private static void GetGameManual(Game g)
 {
     string str = WebUtility.UrlEncode(g.Title);
     Process.Start(string.Format("http://www.replacementdocs.com/search.php?q={0}&r=0&s=Search&in=&ex=&ep=&be=&t=downloads&adv=1&cat=15&on=new&time=any&author=&match=0", str));
 }
Exemple #12
0
 private static void ShowShaderSelection(Game g)
 {
     wndShaderConfig config = new wndShaderConfig {
         Tag = g
     };
     bool flag1 = config.ShowDialog() == true;
 }
Exemple #13
0
 private static void ShowScreenshots(Game g)
 {
     wndScreenshots screenshots = new wndScreenshots {
         Tag = g
     };
     if (screenshots.ShowDialog() == true)
     {
         GC.Collect();
     }
 }
Exemple #14
0
 private static void ShowMemoryCardSelection(Game g)
 {
     wndMemCard card = new wndMemCard {
         Tag = g
     };
     bool flag1 = card.ShowDialog() == true;
 }
Exemple #15
0
 private static void ShowExecutableSelection(Game g)
 {
     wndExecutableSelection selection = new wndExecutableSelection {
         Tag = g
     };
     bool flag1 = selection.ShowDialog() == true;
 }
Exemple #16
0
 private static void ShowCustomConfig(Game g)
 {
     wndCustomConfig config = new wndCustomConfig {
         Tag = g
     };
     GameManager.ImportConfig(g);
     bool flag1 = config.ShowDialog() == true;
 }