Skip to content

Commit

Permalink
Merge branch 'fix-progress-percentage' into all-my-reqs
Browse files Browse the repository at this point in the history
  • Loading branch information
DrPleaseRespect committed Sep 10, 2022
2 parents 86c9990 + 7416fa2 commit b5d846d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion Code/Implementations/EsrganNcnn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,15 @@ private static void OutputHandler(string line, bool error)

Logger.Log("[NCNN] " + line.Replace("\n", " ").Replace("\r", " "));

if(error)
bool showTileProgress = Upscale.currentMode == Upscale.UpscaleMode.Preview || Upscale.currentMode == Upscale.UpscaleMode.Single;

if (showTileProgress && line.Trim().EndsWith("%"))
{
float percent = float.Parse(line.Replace("%", "").Replace(",", "."));
Program.mainForm.SetProgress(percent, $"Upscaling Tiles ({percent}%)");
}

if (error)
GeneralOutputHandler.HandleImpErrorMsgs(line, GeneralOutputHandler.ProcessType.Ncnn);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Code/Implementations/RealEsrganNcnn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private static void OutputHandler(string line, bool error)

if (showTileProgress && line.Trim().EndsWith("%"))
{
float percent = float.Parse(line.Replace("%", "").Replace(",", ".")) / 100f;
float percent = float.Parse(line.Replace("%", "").Replace(",", "."));
Program.mainForm.SetProgress(percent, $"Upscaling Tiles ({percent}%)");
}

Expand Down

0 comments on commit b5d846d

Please sign in to comment.