Example #1
0
        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;
            }
        }
        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);
        }
Example #3
0
        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;
            }
        }
        void SavedSFAFile()
        {
            SfoFile GameSFO = new SfoFile();

            GameSFO.Load(File.ReadAllBytes(_DataDriectory + "GAME.SFO"));

            ((Item)DataGame.SelectedValue).Detail.Release     = GameSFO.Param("RELEASE");
            ((Item)DataGame.SelectedValue).Detail.Player      = GameSFO.Param("PLAYERS");
            ((Item)DataGame.SelectedValue).Detail.Genre       = GameSFO.Param("GENRE");
            ((Item)DataGame.SelectedValue).Detail.Developer   = GameSFO.Param("DEVELOPER");
            ((Item)DataGame.SelectedValue).Detail.Publisher   = GameSFO.Param("PUBLISHER");
            ((Item)DataGame.SelectedValue).Detail.Description = GameSFO.Param("DESCRIPTION");

            DataGame.IsEnabled       = true;
            btnSaveLibrary.IsEnabled = true;
        }
Example #5
0
        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);
        }
Example #6
0
        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();
            }
        }
Example #7
0
        void SavedSFAFile()
        {
            SfoFile GameSFO = new SfoFile();
            GameSFO.Load(File.ReadAllBytes(_DataDriectory + "GAME.SFO"));

            ((Item)DataGame.SelectedValue).Detail.Release = GameSFO.Param("RELEASE");
            ((Item)DataGame.SelectedValue).Detail.Player = GameSFO.Param("PLAYERS");
            ((Item)DataGame.SelectedValue).Detail.Genre = GameSFO.Param("GENRE");
            ((Item)DataGame.SelectedValue).Detail.Developer = GameSFO.Param("DEVELOPER");
            ((Item)DataGame.SelectedValue).Detail.Publisher = GameSFO.Param("PUBLISHER");
            ((Item)DataGame.SelectedValue).Detail.Description = GameSFO.Param("DESCRIPTION");

            DataGame.IsEnabled = true;
            btnSaveLibrary.IsEnabled = true;
        } 
Example #8
0
        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);
        }
        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();
            }
        }