Improved path char check, fixed SBS GUI

This commit is contained in:
N00MKRAD
2021-02-01 22:06:50 +01:00
parent f11611f32e
commit dd79c5a2a8
6 changed files with 15 additions and 16 deletions

View File

@@ -108,7 +108,7 @@ namespace Flowframes
public static string StripBadChars(this string str)
{
string outStr = Regex.Replace(str, @"[^\u0020-\u007E]", string.Empty);
outStr = outStr.Remove("(").Remove(")").Remove("[").Remove("]").Remove("{").Remove("}").Remove("%").Remove("'");
outStr = outStr.Remove("(").Remove(")").Remove("[").Remove("]").Remove("{").Remove("}").Remove("%").Remove("'").Remove("~");
return outStr;
}

View File

@@ -432,7 +432,8 @@ namespace Flowframes
stepSelector.SelectedIndex = 0;
}
runBtn.Visible = Config.GetInt("processingMode") == 1 || Program.busy;
bool stepByStep = Config.GetInt("processingMode") == 1;
runBtn.Visible = !stepByStep && !Program.busy;
}
private async void runStepBtn_Click(object sender, EventArgs e)

View File

@@ -749,5 +749,10 @@ namespace Flowframes.IO
}
return buffer;
}
public static bool HasBadChars(string str)
{
return str != str.StripBadChars();
}
}
}

View File

@@ -38,7 +38,7 @@ namespace Flowframes
if (!Utils.CheckAiAvailable(current.ai)) return; // Check if selected AI pkg is installed
if (!Utils.CheckDeleteOldTempFolder()) return; // Try to delete temp folder if an old one exists
if (!Utils.CheckPathValid(current.inPath)) return; // Check if input path/file is valid
Utils.PathAsciiCheck(current.inPath, current.outPath);
Utils.PathAsciiCheck(current.outPath, "output path");
currentInputFrameCount = await Utils.GetInputFrameCountAsync(current.inPath);
current.stepByStep = false;
Program.mainForm.SetStatus("Starting...");

View File

@@ -253,18 +253,10 @@ namespace Flowframes.Main
return passes;
}
public static void PathAsciiCheck (string inpath, string outpath)
{
bool shownMsg = false;
if (OSUtils.HasNonAsciiChars(inpath))
{
ShowMessage("Warning: Input path includes non-ASCII characters. This might cause problems.");
shownMsg = true;
}
if (!shownMsg && OSUtils.HasNonAsciiChars(outpath))
ShowMessage("Warning: Output path includes non-ASCII characters. This might cause problems.");
public static void PathAsciiCheck (string path, string pathTitle)
{
if (IOUtils.HasBadChars(path) || OSUtils.HasNonAsciiChars(path))
ShowMessage($"Warning: Your {pathTitle} includes special characters. This might cause problems.");
}
public static void GifCompatCheck (Interpolate.OutMode outMode, float fpsOut, int targetFrameCount)

View File

@@ -20,12 +20,13 @@ namespace Flowframes.UI
{
Program.mainForm.SetTab("interpolate");
Program.mainForm.ResetInputInfo();
string path = inputTbox.Text.Trim();
InterpolateUtils.PathAsciiCheck(path, "input path");
if (Config.GetBool("clearLogOnInput"))
Logger.ClearLogBox();
outputTbox.Text = inputTbox.Text.Trim().GetParentDir();
string path = inputTbox.Text.Trim();
Program.lastInputPath = path;
Program.lastInputPathIsSsd = OSUtils.DriveIsSSD(path);