public static string GetTempFolderLoc(string inPath, string outPath) { string basePath = inPath.GetParentDir(); if (Config.GetInt(Config.Key.tempFolderLoc) == 1) { basePath = outPath.GetParentDir(); } if (Config.GetInt(Config.Key.tempFolderLoc) == 2) { basePath = outPath; } if (Config.GetInt(Config.Key.tempFolderLoc) == 3) { basePath = Paths.GetExeDir(); } if (Config.GetInt(Config.Key.tempFolderLoc) == 4) { string custPath = Config.Get(Config.Key.tempDirCustom); if (IoUtils.IsDirValid(custPath)) { basePath = custPath; } } return(Path.Combine(basePath, Path.GetFileNameWithoutExtension(inPath).StripBadChars().Remove(" ").Trunc(30, false) + "-temp")); }
public static bool InputIsValid(string inDir, string outDir, Fraction fpsIn, float factor, I.OutMode outMode) { try { bool passes = true; bool isFile = !IoUtils.IsPathDirectory(inDir); float fpsOut = fpsIn.GetFloat() * factor; if ((passes && isFile && !IoUtils.IsFileValid(inDir)) || (!isFile && !IoUtils.IsDirValid(inDir))) { UiUtils.ShowMessageBox("Input path is not valid!"); passes = false; } if (passes && !IoUtils.IsDirValid(outDir)) { UiUtils.ShowMessageBox("Output path is not valid!"); passes = false; } if (passes && fpsOut < 1f || fpsOut > 1000f) { string imgSeqNote = isFile ? "" : "\n\nWhen using an image sequence as input, you always have to specify the frame rate manually."; UiUtils.ShowMessageBox($"Invalid output frame rate ({fpsOut}).\nMust be 1-1000.{imgSeqNote}"); passes = false; } string fpsLimitValue = Config.Get(Config.Key.maxFps); float fpsLimit = (fpsLimitValue.Contains("/") ? new Fraction(Config.Get(Config.Key.maxFps)).GetFloat() : fpsLimitValue.GetFloat()); if (outMode == I.OutMode.VidGif && fpsOut > 50 && !(fpsLimit > 0 && fpsLimit <= 50)) { Logger.Log($"Warning: GIF will be encoded at 50 FPS instead of {fpsOut} as the format doesn't support frame rates that high."); } if (!passes) { I.Cancel("Invalid settings detected.", true); } return(passes); } catch (Exception e) { Logger.Log($"Failed to run InputIsValid: {e.Message}\n{e.StackTrace}", true); return(false); } }
public static bool CheckPathValid(string path) { if (IoUtils.IsPathDirectory(path)) { if (!IoUtils.IsDirValid(path)) { UiUtils.ShowMessageBox("Input directory is not valid.\nMake sure it still exists and hasn't been renamed or moved!"); I.Cancel(); return(false); } } else { if (!IsVideoValid(path)) { UiUtils.ShowMessageBox("Input video file is not valid.\nMake sure it still exists and hasn't been renamed or moved!"); return(false); } } return(true); }