private void SyncISO_DoWork(object sender, DoWorkEventArgs e) { try { switch (Path.GetExtension(_ISOGame).ToLower()) { case ".iso": PSPGame FileGame = new PSPGame(_ISOGame); if (FileGame.Readable) { SfoFile GameSFO = new SfoFile(); GameSFO.Load(FileGame.ReadAllByte("PSP_GAME\\PARAM.SFO")); _ConfigTemp += GameSFO.Param("DISC_ID") + "\\"; _ItemGame = InitializeStore.GetLibrary(FileGame, _ConfigStore + GameSFO.Param("DISC_ID") + "\\", 0); } else { throw new NotImplementedException(); } break; case ".pbp": break; } } catch { _SyncISO.ReportProgress(-1); e.Cancel = true; } }
private void SyncISO_DoWork(object sender, DoWorkEventArgs e) { try { switch(Path.GetExtension(_ISOGame).ToLower()) { case ".iso": PSPGame FileGame = new PSPGame(_ISOGame); if (FileGame.Readable) { SfoFile GameSFO = new SfoFile(); GameSFO.Load(FileGame.ReadAllByte("PSP_GAME\\PARAM.SFO")); _ConfigTemp += GameSFO.Param("DISC_ID") + "\\"; _ItemGame = InitializeStore.GetLibrary(FileGame, _ConfigStore + GameSFO.Param("DISC_ID") + "\\", 0); } else { throw new NotImplementedException(); } break; case ".pbp": break; } } catch { _SyncISO.ReportProgress(-1); e.Cancel = true; } }
public void GetLibraryData(Item[] data) { DataGame.Items.Clear(); Int32 LenguageEnglish = 0; Int32 LenguageJapan = 0; Int32 LenguageOther = 0; Int64 TotalSize = 0; Int64 TotalGame = 0; foreach (Item rows in data) { if (rows != null) { TotalGame++; DataGame.Items.Add(rows); if (rows.Region == "USA" || rows.Region == "Europe") { LenguageEnglish++; } else if (rows.Region == "Japan") { LenguageJapan++; } else { LenguageOther++; } TotalSize += rows.Detail.Size; } } lblTotalGame.Content = TotalGame + " Games"; lblTotalSize.Content = PSPGame.GetSize(TotalSize); lblLanguage.Content = ""; if (LenguageEnglish != 0) { lblLanguage.Content += "English(" + LenguageEnglish + ") "; } if (LenguageJapan != 0) { lblLanguage.Content += "Japan(" + LenguageJapan + ") "; } if (LenguageOther != 0) { lblLanguage.Content += "Other(" + LenguageOther + ") "; } DataGame.Columns[1].SortDirection = ListSortDirection.Ascending; }
public static Item GetLibrary(PSPGame isoGame, String dataDirectory, Int32 index) { if (!Directory.Exists(dataDirectory)) { Directory.CreateDirectory(dataDirectory); } if (!File.Exists(dataDirectory + "GAME.SFO")) { isoGame.ExtractFile("PSP_GAME\\PARAM.SFO", dataDirectory + "GAME.SFO"); } if (!File.Exists(dataDirectory + "ICON.PNG")) { isoGame.ExtractFile("PSP_GAME\\ICON0.PNG", dataDirectory + "ICON.PNG"); } if (!File.Exists(dataDirectory + "PIC.PNG")) { isoGame.ExtractFile("PSP_GAME\\PIC1.PNG", dataDirectory + "PIC.PNG"); } Item Param = new Item(); SfoFile GameSFO = new SfoFile(); GameSFO.Load(File.ReadAllBytes(dataDirectory + "GAME.SFO")); String[] DirectoryName = Path.GetDirectoryName(isoGame.FileName).Split('\\'); Param.DiscID = GameSFO.Param("DISC_ID"); Param.Title = GameSFO.Param("TITLE"); Param.Filename = Path.GetFileName(isoGame.FileName); Param.Region = Item.GetRegion(GameSFO.Param("DISC_ID")); Param.Firmware = GameSFO.Param("PSP_SYSTEM_VER"); Param.Index = index; Param.Detail = new ItemData() { GameDirectory = Path.GetDirectoryName(isoGame.FileName), Name = DirectoryName[DirectoryName.Length - 1], Icon = null, Background = null, Title = GameSFO.Param("TITLE"), Version = GameSFO.Param("DISC_VERSION"), Parental = GameSFO.Param("PARENTAL_LEVEL"), Catagory = GameSFO.Param("CATEGORY"), Type = Item.GetType(GameSFO.Param("DISC_ID")), Size = isoGame.FileSize, Created = File.GetCreationTime(isoGame.FileName).ToString().Split(' ')[0], Release = GameSFO.Param("RELEASE"), Player = GameSFO.Param("PLAYERS"), Genre = GameSFO.Param("GENRE"), Developer = GameSFO.Param("DEVELOPER"), Publisher = GameSFO.Param("PUBLISHER"), Description = GameSFO.Param("DESCRIPTION"), Snapshot1 = null, Snapshot2 = null, Snapshot3 = null, Snapshot4 = null, Snapshot5 = null, Snapshot6 = null, }; // IF Image Exists Change if (File.Exists(dataDirectory + "ICON.PNG")) { Param.Detail.Icon = "ICON.PNG"; } if (File.Exists(dataDirectory + "PIC.PNG")) { Param.Detail.Background = "PIC.PNG"; Param.Detail.Snapshot1 = "PIC.PNG"; } if (File.Exists(dataDirectory + "SS1.PNG")) { Param.Detail.Snapshot1 = "SS1.PNG"; } if (File.Exists(dataDirectory + "SS2.PNG")) { Param.Detail.Snapshot2 = "SS2.PNG"; } if (File.Exists(dataDirectory + "SS3.PNG")) { Param.Detail.Snapshot3 = "SS3.PNG"; } if (File.Exists(dataDirectory + "SS4.PNG")) { Param.Detail.Snapshot4 = "SS4.PNG"; } if (File.Exists(dataDirectory + "SS5.PNG")) { Param.Detail.Snapshot5 = "SS5.PNG"; } if (File.Exists(dataDirectory + "SS6.PNG")) { Param.Detail.Snapshot6 = "SS6.PNG"; } return(Param); }
void _SyncGame_DoWork(object sender, DoWorkEventArgs e) { String _ConfigFolder = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\"; String _ConfigStore = _ConfigFolder + "PSPStore\\"; SfoFile _ConfigDefault = new SfoFile(); String pathConfigFile = _ConfigFolder + "setting.cfg"; try { _ConfigDefault.Load(File.ReadAllBytes(pathConfigFile)); if (Directory.Exists(_ConfigDefault.Param("PSPGame"))) { _PreloadTitle = "Create Directory"; _PreloadSubject = "Please wait..."; _PreloadLength = 0; _PreloadMaxinium = Directory.GetFiles(_ConfigDefault.Param("PSPGame")).Length; _SyncGame.ReportProgress(0); foreach (String name in Directory.GetFiles(_ConfigDefault.Param("PSPGame"))) { string extens = Path.GetExtension(name).ToLower(); if (extens == ".iso" || extens == ".cso" || extens == ".pbp") { _PreloadLength++; Directory.CreateDirectory(_ConfigDefault.Param("PSPGame") + "\\" + Path.GetFileNameWithoutExtension(name)); File.Move(name, _ConfigDefault.Param("PSPGame") + "\\" + Path.GetFileNameWithoutExtension(name) + "\\" + Path.GetFileName(name)); _SyncGame.ReportProgress(_PreloadLength); } } Int32 DataLength = 0; _PreloadTitle = "Initialize...."; _PreloadLength = 0; _PreloadMaxinium = Directory.GetDirectories(_ConfigDefault.Param("PSPGame")).Length - 1; GameLibrary = new Item[_PreloadMaxinium + 1]; _SyncGame.ReportProgress(0); foreach (String name in Directory.GetDirectories(_ConfigDefault.Param("PSPGame"))) { if (PermissionDirectory(name)) { foreach (String file in Directory.GetFiles(name)) { _SyncGame.ReportProgress(_PreloadLength); switch (Path.GetExtension(file).ToLower()) { case ".iso": PSPGame FileGame = new PSPGame(file); if (FileGame.Readable) { SfoFile GameSFO = new SfoFile(); GameSFO.Load(FileGame.ReadAllByte("PSP_GAME\\PARAM.SFO")); _PreloadSubject = GameSFO.Param("TITLE"); String DataDirectory = _ConfigStore + GameSFO.Param("DISC_ID") + "\\"; GameLibrary[DataLength] = InitializeStore.GetLibrary(FileGame, DataDirectory, DataLength); DataLength++; } break; case ".pbp": //var psi = new ProcessStartInfo //{ // FileName = @"c:\work\test.exe", // Arguments = @"param1 param2", // UseShellExecute = false, // RedirectStandardOutput = true, //}; //var process = Process.Start(psi); //if (process.WaitForExit((int)TimeSpan.FromSeconds(10).TotalMilliseconds)) //{ // var result = process.StandardOutput.ReadToEnd(); // Console.WriteLine(result); //} break; case ".cso": break; } } } _PreloadLength++; } } } catch (Exception ex) { _SyncGame.CancelAsync(); } }
void SelectedDataGame() { Item Selected = (Item)DataGame.SelectedValue; _DataDriectory = _ConfigStore + Selected.DiscID + "\\"; switch (Int32.Parse(_ConfigDefault.Param("Mode"))) { case 0: ImageIcon.Source = GetImage("none.jpg"); ImageBackground.Source = GetImage("ScreenShot.png"); lblTitleGame.Content = Selected.Detail.Title; lblFilename.Content = Selected.Detail.Name; lblVersion.Content = Selected.Detail.Version; lblFirmware.Content = Selected.Firmware; lblParental.Content = Selected.Detail.Parental; lblRegion.Content = Selected.Region; lblRelease.Content = DateTime.FromBinary(Int64.Parse(Selected.Detail.Release)).ToShortDateString(); lblPlayers.Content = Selected.Detail.Player; lblGenre.Content = Selected.Detail.Genre; lblCatalogory.Content = Selected.Detail.Catagory + "-" + Selected.DiscID; lblType.Content = Selected.Detail.Type; lblCreated.Content = Selected.Detail.Created; lblSize.Content = PSPGame.GetSize(Selected.Detail.Size); lblPublisher.Content = Selected.Detail.Publisher; lblDeveloper.Content = Selected.Detail.Developer; // Preview ImageSnap1.Source = GetImage("none.jpg"); ImageSnap2.Source = GetImage("none.jpg"); ImageSnap3.Source = GetImage("none.jpg"); ImageSnap4.Source = GetImage("none.jpg"); ImageSnap5.Source = GetImage("none.jpg"); ImageSnap6.Source = GetImage("none.jpg"); if (Selected.Detail.Release == "0") { lblRelease.Content = "N/A"; } if (Selected.Detail.Player == "0") { lblPlayers.Content = "N/A"; } if (Selected.Detail.Genre == "0") { lblGenre.Content = "N/A"; } if (Selected.Detail.Publisher == "0") { lblPublisher.Content = "N/A"; } if (Selected.Detail.Developer == "0") { lblDeveloper.Content = "N/A"; } if (Selected.Detail.Icon != null) { ImageIcon.Source = BitmapFrame.Create(new Uri(_DataDriectory + Selected.Detail.Icon)); } if (Selected.Detail.Background != null) { ImageBackground.Source = BitmapFrame.Create(new Uri(_DataDriectory + Selected.Detail.Background)); } if (Selected.Detail.Snapshot1 != null) { ImageSnap1.Source = BitmapFrame.Create(new Uri(_DataDriectory + Selected.Detail.Snapshot1)); } if (Selected.Detail.Snapshot2 != null) { ImageSnap2.Source = BitmapFrame.Create(new Uri(_DataDriectory + Selected.Detail.Snapshot2)); } if (Selected.Detail.Snapshot3 != null) { ImageSnap3.Source = BitmapFrame.Create(new Uri(_DataDriectory + Selected.Detail.Snapshot3)); } if (Selected.Detail.Snapshot4 != null) { ImageSnap4.Source = BitmapFrame.Create(new Uri(_DataDriectory + Selected.Detail.Snapshot4)); } if (Selected.Detail.Snapshot5 != null) { ImageSnap5.Source = BitmapFrame.Create(new Uri(_DataDriectory + Selected.Detail.Snapshot5)); } if (Selected.Detail.Snapshot6 != null) { ImageSnap6.Source = BitmapFrame.Create(new Uri(_DataDriectory + Selected.Detail.Snapshot6)); } break; case 1: EditName.Text = Selected.Detail.Name; EditPublisher.Text = Selected.Detail.Publisher; EditDeveloper.Text = Selected.Detail.Developer; EditDescription.Text = Selected.Detail.Description; EditRelease.SelectedDate = DateTime.FromBinary(Int64.Parse(Selected.Detail.Release)); if (Selected.Detail.Release == "0") { EditRelease.SelectedDate = DateTime.Now; } if (Selected.Detail.Publisher == "0") { EditPublisher.Text = ""; } if (Selected.Detail.Developer == "0") { EditDeveloper.Text = ""; } if (Selected.Detail.Description == "0") { EditDescription.Text = ""; } foreach (ComboBoxItem item in EditGenre.Items) { if (item.Content.ToString() == Selected.Detail.Genre.ToString()) { EditGenre.SelectedItem = item; break; } } switch (Int32.Parse(Selected.Detail.Player)) { case 1: EditPlayer1.IsChecked = true; break; case 2: EditPlayer2.IsChecked = true; break; case 3: EditPlayer3.IsChecked = true; break; case 4: EditPlayer4.IsChecked = true; break; case 5: EditPlayer5.IsChecked = true; break; } break; } }
public static Item GetLibrary(PSPGame isoGame, String dataDirectory, Int32 index) { if (!Directory.Exists(dataDirectory)) Directory.CreateDirectory(dataDirectory); if (!File.Exists(dataDirectory + "GAME.SFO")) isoGame.ExtractFile("PSP_GAME\\PARAM.SFO", dataDirectory + "GAME.SFO"); if (!File.Exists(dataDirectory + "ICON.PNG")) isoGame.ExtractFile("PSP_GAME\\ICON0.PNG", dataDirectory + "ICON.PNG"); if (!File.Exists(dataDirectory + "PIC.PNG")) isoGame.ExtractFile("PSP_GAME\\PIC1.PNG", dataDirectory + "PIC.PNG"); Item Param = new Item(); SfoFile GameSFO = new SfoFile(); GameSFO.Load(File.ReadAllBytes(dataDirectory + "GAME.SFO")); String[] DirectoryName = Path.GetDirectoryName(isoGame.FileName).Split('\\'); Param.DiscID = GameSFO.Param("DISC_ID"); Param.Filename = Path.GetFileName(isoGame.FileName); Param.Region = Item.GetRegion(GameSFO.Param("DISC_ID")); Param.Firmware = GameSFO.Param("PSP_SYSTEM_VER"); Param.Index = index; Param.Detail = new ItemData() { GameDirectory = Path.GetDirectoryName(isoGame.FileName), Name = DirectoryName[DirectoryName.Length - 1], Icon = null, Background = null, Title = GameSFO.Param("TITLE"), Version = GameSFO.Param("DISC_VERSION"), Parental = GameSFO.Param("PARENTAL_LEVEL"), Catagory = GameSFO.Param("CATEGORY"), Type = Item.GetType(GameSFO.Param("DISC_ID")), Size = isoGame.FileSize, Created = File.GetCreationTime(isoGame.FileName).ToString().Split(' ')[0], Release = GameSFO.Param("RELEASE"), Player = GameSFO.Param("PLAYERS"), Genre = GameSFO.Param("GENRE"), Developer = GameSFO.Param("DEVELOPER"), Publisher = GameSFO.Param("PUBLISHER"), Description = GameSFO.Param("DESCRIPTION"), Snapshot1 = null, Snapshot2 = null, Snapshot3 = null, Snapshot4 = null, Snapshot5 = null, Snapshot6 = null, }; // IF Image Exists Change if (File.Exists(dataDirectory + "ICON.PNG")) Param.Detail.Icon = "ICON.PNG"; if (File.Exists(dataDirectory + "PIC.PNG")) { Param.Detail.Background = "PIC.PNG"; Param.Detail.Snapshot1 = "PIC.PNG"; } if (File.Exists(dataDirectory + "SS1.PNG")) Param.Detail.Snapshot1 = "SS1.PNG"; if (File.Exists(dataDirectory + "SS2.PNG")) Param.Detail.Snapshot2 = "SS2.PNG"; if (File.Exists(dataDirectory + "SS3.PNG")) Param.Detail.Snapshot3 = "SS3.PNG"; if (File.Exists(dataDirectory + "SS4.PNG")) Param.Detail.Snapshot4 = "SS4.PNG"; if (File.Exists(dataDirectory + "SS5.PNG")) Param.Detail.Snapshot5 = "SS5.PNG"; if (File.Exists(dataDirectory + "SS6.PNG")) Param.Detail.Snapshot6 = "SS6.PNG"; return Param; }
void _SyncGame_DoWork(object sender, DoWorkEventArgs e) { String _ConfigFolder = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\"; String _ConfigStore = _ConfigFolder + "PSPStore\\"; SfoFile _ConfigDefault = new SfoFile(); String pathConfigFile = _ConfigFolder + "setting.cfg"; try { _ConfigDefault.Load(File.ReadAllBytes(pathConfigFile)); if (Directory.Exists(_ConfigDefault.Param("PSPGame"))) { _PreloadTitle = "Create Directory"; _PreloadSubject = "Please wait..."; _PreloadLength = 0; _PreloadMaxinium = Directory.GetFiles(_ConfigDefault.Param("PSPGame")).Length; _SyncGame.ReportProgress(0); foreach (String name in Directory.GetFiles(_ConfigDefault.Param("PSPGame"))) { string extens = Path.GetExtension(name).ToLower(); if (extens == ".iso" || extens == ".cso" || extens == ".pbp") { _PreloadLength++; Directory.CreateDirectory(_ConfigDefault.Param("PSPGame") + "\\" + Path.GetFileNameWithoutExtension(name)); File.Move(name, _ConfigDefault.Param("PSPGame") + "\\" + Path.GetFileNameWithoutExtension(name) + "\\" + Path.GetFileName(name)); _SyncGame.ReportProgress(_PreloadLength); } } Int32 DataLength = 0; _PreloadTitle = "Initialize...."; _PreloadLength = 0; _PreloadMaxinium = Directory.GetDirectories(_ConfigDefault.Param("PSPGame")).Length - 1; GameLibrary = new Item[_PreloadMaxinium + 1]; _SyncGame.ReportProgress(0); foreach (String name in Directory.GetDirectories(_ConfigDefault.Param("PSPGame"))) { if (PermissionDirectory(name)) { foreach (String file in Directory.GetFiles(name)) { _SyncGame.ReportProgress(_PreloadLength); switch (Path.GetExtension(file).ToLower()) { case ".iso": PSPGame FileGame = new PSPGame(file); if (FileGame.Readable) { SfoFile GameSFO = new SfoFile(); GameSFO.Load(FileGame.ReadAllByte("PSP_GAME\\PARAM.SFO")); _PreloadSubject = GameSFO.Param("TITLE"); String DataDirectory = _ConfigStore + GameSFO.Param("DISC_ID") + "\\"; GameLibrary[DataLength] = InitializeStore.GetLibrary(FileGame, DataDirectory, DataLength); DataLength++; } break; case ".pbp": //var psi = new ProcessStartInfo //{ // FileName = @"c:\work\test.exe", // Arguments = @"param1 param2", // UseShellExecute = false, // RedirectStandardOutput = true, //}; //var process = Process.Start(psi); //if (process.WaitForExit((int)TimeSpan.FromSeconds(10).TotalMilliseconds)) //{ // var result = process.StandardOutput.ReadToEnd(); // Console.WriteLine(result); //} break; case ".cso": break; } } } _PreloadLength++; } } } catch { _SyncGame.CancelAsync(); } }
private void SyncISO_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { ImagePreview.Cursor = Cursors.Arrow; if (!(e.Error == null)) { } else if (e.Cancelled) { lblPreload.Cursor = Cursors.Arrow; lblFilename.Cursor = Cursors.Arrow; CaptionClose.Visibility = Visibility.Hidden; btnExit.Visibility = Visibility.Visible; } else { String DataDirectory = _ConfigStore + _ItemGame.DiscID + "\\"; ImageSource _IconGame = BitmapFrame.Create(new Uri(DataDirectory + _ItemGame.Detail.Icon)); Console.WriteLine(_IconGame.Height + "==" + _IconGame.Width); //IconBorder.Width = _IconGame.Width; IconImage.Source = _IconGame; if (_ItemGame.Detail.Snapshot1 != null) { SSImage1.Source = BitmapFrame.Create(new Uri(DataDirectory + _ItemGame.Detail.Snapshot1)); } else { SSBorder1.Visibility = Visibility.Hidden; } if (_ItemGame.Detail.Snapshot2 != null) { SSImage2.Source = BitmapFrame.Create(new Uri(DataDirectory + _ItemGame.Detail.Snapshot2)); } else { SSBorder2.Visibility = Visibility.Hidden; } if (_ItemGame.Detail.Snapshot3 != null) { SSImage3.Source = BitmapFrame.Create(new Uri(DataDirectory + _ItemGame.Detail.Snapshot3)); } else { SSBorder3.Visibility = Visibility.Hidden; } if (_ItemGame.Detail.Snapshot4 != null) { SSImage4.Source = BitmapFrame.Create(new Uri(DataDirectory + _ItemGame.Detail.Snapshot4)); } else { SSBorder4.Visibility = Visibility.Hidden; } if (_ItemGame.Detail.Snapshot5 != null) { SSImage5.Source = BitmapFrame.Create(new Uri(DataDirectory + _ItemGame.Detail.Snapshot5)); } else { SSBorder5.Visibility = Visibility.Hidden; } if (_ItemGame.Detail.Snapshot6 != null) { SSImage6.Source = BitmapFrame.Create(new Uri(DataDirectory + _ItemGame.Detail.Snapshot6)); } else { SSBorder6.Visibility = Visibility.Hidden; } txtTitleGame.Text = _ItemGame.Detail.Title; lblFilename1.Content = Path.GetFileNameWithoutExtension(_ISOGame); lblCreated.Content = _ItemGame.Detail.Created; lblSize.Content = PSPGame.GetSize(_ItemGame.Detail.Size); lblRegion.Content = _ItemGame.Detail.Type; lblGenre.Content = _ItemGame.Detail.Genre; lblRelease.Content = DateTime.FromBinary(Int64.Parse(_ItemGame.Detail.Release)).ToShortDateString(); lblPlayers.Content = _ItemGame.Detail.Player; lblPublisher.Content = _ItemGame.Detail.Publisher; lblDeveloper.Content = _ItemGame.Detail.Developer; lblDescription.Text = _ItemGame.Detail.Description; lblCatalogory.Content = _ItemGame.Detail.Catagory + "-" + _ItemGame.DiscID; lblVersion.Content = _ItemGame.Detail.Version; lblFirmware.Content = _ItemGame.Firmware; lblParental.Content = _ItemGame.Detail.Parental; if (lblGenre.Content.ToString() == "0") { lblGenre.Content = "N/A"; } if (lblRegion.Content.ToString() == "0") { lblRegion.Content = "N/A"; } if (lblRelease.Content.ToString() == "0") { lblRelease.Content = "N/A"; } if (lblPlayers.Content.ToString() == "0") { lblPlayers.Content = "N/A"; } if (lblPublisher.Content.ToString() == "0") { lblPublisher.Content = "N/A"; } if (lblDeveloper.Content.ToString() == "0") { lblDeveloper.Content = "N/A"; } if (lblDescription.Text.ToString() == "0") { lblDescription.Text = "N/A"; } // View Details GridPreload.Visibility = Visibility.Hidden; GridDetails.Visibility = Visibility.Visible; GridScreenshot.Visibility = Visibility.Visible; _CloseDialog = true; } }