private void Builder_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker a = sender as BackgroundWorker; PS2ImageMaker.StartPacking(buildInputPath, buildOutputPath); int progress; while (!Builder_CheckProgress(out progress)) { a.ReportProgress(progress); Thread.Sleep(100); } }
bool Builder_CheckProgress(out int prog) { var progress = PS2ImageMaker.PollProgress(); int progPercent = (int)(progress.ProgressPercentage * 100); prog = progPercent; //progressBar1.Value = (int)((progPercent / 4f) + 75f); //UpdateProcessText($"{ModLoaderText.Process_Step3_ROM} {progPercent}%"); switch (progress.ProgressS) { default: return(false); case PS2ImageMaker.ProgressState.FAILED: Console.WriteLine("Error: PS2 Image Build failed!"); return(true); case PS2ImageMaker.ProgressState.FINISHED: return(true); } }