Ejemplo n.º 1
0
        private void browseDisc1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Title  = "Select PS1 Disc image *.cue";
            ofd.Filter = "Cue Sheet Files (*.cue)|*.cue";
            ofd.ShowDialog();

            string fileName = ofd.FileName;

            Disc1Path.Text = fileName;

            string BinFile     = CueReader.Read(fileName).First().FileName;
            string BinFilePath = Path.Combine(Path.GetDirectoryName(fileName), BinFile);

            GameEntry gmEntry = PackagePsx.FindGameInfo(BinFilePath);

            DiscId.Text = gmEntry.GameID;

            MobyGamesDB.GetGameInformation(gmEntry.GameID);
            GameTitle.Text       = MobyGamesDB.Name;
            SaveDescription.Text = MobyGamesDB.Name + " - Save Data";

            if (MobyGamesDB.CoverImage != "(none)")
            {
                try
                {
                    BubbleIconPath.Text = MobyGamesDB.CoverImage;

                    WebClient    wc        = new WebClient();
                    byte[]       ImageData = wc.DownloadData(MobyGamesDB.CoverImage);
                    MemoryStream ms        = new MemoryStream(ImageData);
                    Bitmap       bmp       = new Bitmap(ms);
                    Bitmap       resized   = new Bitmap(bmp, new Size(80, 80));

                    bmp.Dispose();
                    BubbleIcon.BackgroundImage.Dispose();

                    BubbleIcon.BackgroundImage = resized;
                }
                catch (Exception) { };
            }
        }
Ejemplo n.º 2
0
        public static async Task ProcessFile(string file, string outPath, string tempPath, int compressionLevel, CancellationToken cancellationToken, string savedesc = "PS1 Game - Saved Data", string name = "PS1 Game", string pic0 = "PIC0.PNG", string pic1 = "PIC1.PNG", string icon0 = "ICON0.PNG", string basePbp = "BASE.PBP")
        {
            Console.WriteLine($"Converting {file}...");

            List <string> tempFiles = null;
            string        srcToc    = null;

            Console.CancelKeyPress += new ConsoleCancelEventHandler(myHandler);
            try
            {
                if (!string.IsNullOrEmpty(file))
                {
                    if (FileExtensionHelper.IsPbp(file))
                    {
                        await ExtractPbp(file, outPath, cancellationToken);
                    }
                    else
                    {
                        if (FileExtensionHelper.IsCue(file))
                        {
                            var filePath = Path.GetDirectoryName(file);

                            var cueFiles = CueReader.Read(file);
                            if (cueFiles.Count > 1)
                            {
                                var mergedBin = MergeBins(file, cueFiles, tempPath);
                                var cueFile   = Path.Combine(tempPath, Path.GetFileNameWithoutExtension(mergedBin.Path) + ".cue");
                                CueWriter.Write(cueFile, mergedBin.CueFiles);
                                srcToc = cueFile;
                                file   = mergedBin.Path;

                                tempFiles.Add(mergedBin.Path);
                                tempFiles.Add(cueFile);
                            }
                            else
                            {
                                srcToc = file;
                                file   = Path.Combine(filePath, cueFiles.First().FileName);
                            }
                        }

                        await ConvertIso(file, srcToc, outPath, compressionLevel, cancellationToken, savedesc, name, pic0, pic1, icon0, basePbp);
                    }
                }
            }
            finally
            {
                Console.CursorVisible = true;
                if (cancellationToken.IsCancellationRequested)
                {
                    Console.WriteLine("Conversion cancelled");
                }
                else
                {
                    Console.WriteLine("Conversion completed!");
                }

                if (tempFiles != null)
                {
                    foreach (var tempFile in tempFiles)
                    {
                        System.IO.File.Delete(tempFile);
                    }
                }
            }
        }