Fixed progress bar in SBS not working correctly

This commit is contained in:
N00MKRAD
2021-01-05 23:13:29 +01:00
parent 49d74f31ce
commit e519e90966
7 changed files with 15 additions and 7 deletions

View File

@@ -91,6 +91,8 @@ namespace Flowframes
public static async Task<string> GetFfmpegOutputAsync(string args, bool setBusy = false)
{
if (Program.busy)
setBusy = false;
lastOutputFfmpeg = "";
Process ffmpeg = OSUtils.NewProcess(true);
lastProcess = ffmpeg;
@@ -181,11 +183,9 @@ namespace Flowframes
{
if (Program.busy) return;
Program.mainForm.SetWorking(true);
await Task.Delay(100);
while(!lastProcess.HasExited)
await Task.Delay(10);
Program.mainForm.SetWorking(false);
}
}
}

View File

@@ -234,6 +234,7 @@ namespace Flowframes
public void SetWorking(bool state, bool allowCancel = true)
{
Logger.Log($"SetWorking({state})");
Control[] controlsToDisable = new Control[] { runBtn, runStepBtn, stepSelector, settingsBtn, installerBtn };
Control[] controlsToHide = new Control[] { runBtn, runStepBtn, stepSelector };
progressCircle.Visible = state;
@@ -242,8 +243,7 @@ namespace Flowframes
c.Enabled = !state;
foreach (Control c in controlsToHide)
c.Visible = !state;
if (!allowCancel)
cancelBtn.Enabled = false;
cancelBtn.Enabled = allowCancel;
Program.busy = state;
Program.mainForm.UpdateStepByStepControls(false);
}

View File

@@ -828,9 +828,9 @@
this.label28.Location = new System.Drawing.Point(10, 150);
this.label28.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
this.label28.Name = "label28";
this.label28.Size = new System.Drawing.Size(158, 16);
this.label28.Size = new System.Drawing.Size(102, 16);
this.label28.TabIndex = 61;
this.label28.Text = "RIFE (CUDA) Settings";
this.label28.Text = "RIFE Settings";
//
// panel12
//

View File

@@ -527,6 +527,11 @@ namespace Flowframes.IO
{
Benchmarker.Start();
string hashStr = "";
if (IsPathDirectory(path))
{
Logger.Log($"Path is directory! Returning empty hash for {Path.GetFileName(path)}", true);
return hashStr;
}
try
{
if (hashType == Hash.MD5)
@@ -550,6 +555,7 @@ namespace Flowframes.IO
catch (Exception e)
{
Logger.Log($"Error getting file hash for {Path.GetFileName(path)}: {e.Message}", true);
return "";
}
if (log)
Logger.Log($"Computed {hashType} for '{Path.GetFileNameWithoutExtension(path).Trunc(40) + Path.GetExtension(path)}' ({GetFilesizeStr(path)}) in {Benchmarker.GetTimeStr(true)}: {hashStr}", true);

View File

@@ -25,6 +25,7 @@ namespace Flowframes.Main
public static async Task Run(string step)
{
Logger.Log($"[SBS] Running step '{step}'", true);
canceled = false;
Program.mainForm.SetWorking(true);
current = Program.mainForm.GetCurrentSettings();

View File

@@ -38,6 +38,7 @@ namespace Flowframes.Main
bool firstProgUpd = true;
Program.mainForm.SetProgress(0);
targetFrames = target;
Logger.Log("Skipping progress count because program is not busy!!", true);
while (Program.busy)
{
if (AiProcess.processTime.IsRunning && Directory.Exists(outdir))

View File

@@ -184,7 +184,7 @@ namespace Flowframes
public static async Task RunRifeNcnnMulti(string framesPath, string outPath, int tilesize, int times)
{
processTimeMulti.Restart();
Logger.Log($"Running RIFE{(InterpolateUtils.UseUHD() ? " (UHD Mode)" : "")} ...", false);
Logger.Log($"Running RIFE{(InterpolateUtils.UseUHD() ? " (UHD Mode)" : "")}...", false);
bool useAutoEnc = Interpolate.currentlyUsingAutoEnc;
if(times > 2)