Esempio n. 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;
            }
        }
Esempio n. 2
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;
            }
        }
Esempio n. 3
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();
            }
        }
Esempio n. 4
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 
            {
                _SyncGame.CancelAsync();
            }
        }