Ejemplo n.º 1
0
        public override void Build(string inputPath, string outputPath)
        {
            // Use CDBuilder
            CDBuilder isoBuild = new CDBuilder();

            isoBuild.UseJoliet        = true;
            isoBuild.VolumeIdentifier = ISO_Label;

            DirectoryInfo        di    = new DirectoryInfo(inputPath);
            HashSet <FileStream> files = new HashSet <FileStream>();

            foreach (DirectoryInfo dir in di.GetDirectories())
            {
                ISO_Common.Recursive_AddDirs(isoBuild, dir, dir.Name + @"\", files, true);
            }
            foreach (FileInfo file in di.GetFiles())
            {
                ISO_Common.AddFile(isoBuild, file, string.Empty, files, true);
            }

            using (FileStream output = new FileStream(outputPath, FileMode.Create, FileAccess.Write))
                using (Stream input = isoBuild.Build())
                {
                    ISO2PSX.Run(input, output);
                }

            //isoBuild.Build(outputPath);

            foreach (FileStream file in files)
            {
                file.Close();
            }
        }
Ejemplo n.º 2
0
        public override void Build(string inputPath, string outputPath)
        {
            if (!isCDimage)
            {
                //Use PS2ImageMaker
                DirectoryInfo di = new DirectoryInfo(inputPath);
                foreach (DirectoryInfo dir in di.EnumerateDirectories())
                {
                    foreach (FileInfo file in dir.EnumerateFiles())
                    {
                        file.MoveTo(file.FullName);
                    }
                    IO_Common.Recursive_RenameFiles(dir);
                }
                foreach (FileInfo file in di.EnumerateFiles())
                {
                    file.MoveTo(file.FullName);
                }

                buildInputPath  = inputPath;
                buildOutputPath = outputPath;

                AsyncWorker = new BackgroundWorker();
                AsyncWorker.WorkerReportsProgress = true;
                AsyncWorker.DoWork             += new DoWorkEventHandler(Builder_DoWork);
                AsyncWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Builder_RunWorkerCompleted);
                AsyncWorker.ProgressChanged    += new ProgressChangedEventHandler(Builder_ProgressChanged);
                AsyncWorker.RunWorkerAsync();
            }
            else
            {
                // Use CDBuilder
                CDBuilder isoBuild = new CDBuilder();
                isoBuild.UseJoliet        = true;
                isoBuild.VolumeIdentifier = ISO_Label;

                // CD image adjustments
                DirectoryInfo dit = new DirectoryInfo(inputPath);
                foreach (DirectoryInfo dir in dit.EnumerateDirectories())
                {
                    foreach (FileInfo file in dir.EnumerateFiles())
                    {
                        file.MoveTo(file.FullName);
                    }
                    IO_Common.Recursive_RenameFiles(dir);
                }
                foreach (FileInfo file in dit.EnumerateFiles())
                {
                    file.MoveTo(file.FullName);
                }

                DirectoryInfo        di    = new DirectoryInfo(inputPath);
                HashSet <FileStream> files = new HashSet <FileStream>();

                foreach (DirectoryInfo dir in di.GetDirectories())
                {
                    ISO_Common.Recursive_AddDirs(isoBuild, dir, dir.Name + @"\", files, true);
                }
                foreach (FileInfo file in di.GetFiles())
                {
                    ISO_Common.AddFile(isoBuild, file, string.Empty, files, true);
                }

                using (FileStream output = new FileStream(outputPath, FileMode.Create, FileAccess.Write))
                    using (Stream input = isoBuild.Build())
                    {
                        ISO2PSX.Run(input, output);
                    }

                foreach (FileStream file in files)
                {
                    file.Close();
                }
            }
        }