From dd4043abe99e0cbbc1e0a02763420657118b349e Mon Sep 17 00:00:00 2001 From: N00MKRAD Date: Thu, 10 Dec 2020 15:19:44 +0100 Subject: [PATCH] Exit if required pkgs are missing, minor cleanups --- Code/Form1.Designer.cs | 3 +-- Code/Forms/SettingsForm.Designer.cs | 6 +++--- Code/IO/IOUtils.cs | 3 +-- Code/IO/Setup.cs | 8 +++++++- Code/Logger.cs | 3 ++- Code/Program.cs | 2 -- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Code/Form1.Designer.cs b/Code/Form1.Designer.cs index dbc5217..8ae2037 100644 --- a/Code/Form1.Designer.cs +++ b/Code/Form1.Designer.cs @@ -650,8 +650,7 @@ this.logBox.Size = new System.Drawing.Size(701, 111); this.logBox.TabIndex = 5; this.logBox.TabStop = false; - this.logBox.Text = "Welcome to Flowframes!\r\nThis is the console output box. Status messages will appe" + - "ar here."; + this.logBox.Text = "Welcome to Flowframes!"; // // inFileDialog // diff --git a/Code/Forms/SettingsForm.Designer.cs b/Code/Forms/SettingsForm.Designer.cs index 3c0dc10..4edce3c 100644 --- a/Code/Forms/SettingsForm.Designer.cs +++ b/Code/Forms/SettingsForm.Designer.cs @@ -1349,10 +1349,10 @@ this.label41.Location = new System.Drawing.Point(308, 213); this.label41.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7); this.label41.Name = "label41"; - this.label41.Size = new System.Drawing.Size(423, 13); + this.label41.Size = new System.Drawing.Size(395, 13); this.label41.TabIndex = 74; - this.label41.Text = "Use alternative method to get the amount of total frames. Slower, but better comp" + - "atibility."; + this.label41.Text = "Use alternative method to get the amount of total frames. Slower, but more reliab" + + "le."; // // ffprobeCountFrames // diff --git a/Code/IO/IOUtils.cs b/Code/IO/IOUtils.cs index 3ae7e2c..41cb175 100644 --- a/Code/IO/IOUtils.cs +++ b/Code/IO/IOUtils.cs @@ -372,14 +372,13 @@ namespace Flowframes.IO } catch (Exception e) { - Logger.Log($"Error trying to delete {path}: {e.Message}", true); + Logger.Log($"TryDeleteIfExists: Error trying to delete {path}: {e.Message}", true); return false; } } public static bool DeleteIfExists (string path) // Returns true if the file/dir exists { - Logger.Log("DeleteIfExists: " + path, true); if (!IsPathDirectory(path) && File.Exists(path)) { File.Delete(path); diff --git a/Code/IO/Setup.cs b/Code/IO/Setup.cs index c2ac8e2..3e47551 100644 --- a/Code/IO/Setup.cs +++ b/Code/IO/Setup.cs @@ -6,6 +6,7 @@ using System.IO; using System.Linq; using System.Windows.Forms; using Flowframes.Forms; +using Flowframes.Main; namespace Flowframes { @@ -18,7 +19,9 @@ namespace Flowframes if (!InstallIsValid()) { Logger.Log("No valid installation detected"); - new InstallerForm().ShowDialog(); + InterpolateUtils.ShowMessage($"Some packages are missing!\n\nCheck the log ({Path.GetFileName(Paths.GetDataPath())}/{Path.GetFileName(Paths.GetLogPath())}/{Logger.defaultLogName}).", "Error"); + Application.Exit(); + //new InstallerForm().ShowDialog(); } else { @@ -39,7 +42,10 @@ namespace Flowframes { // if pkg is required and not installed, return false if (pkg.friendlyName.ToLower().Contains("required") && !PkgUtils.IsInstalled(pkg)) + { + Logger.Log($"Required packages \"{pkg.friendlyName}\" was not found!", true); return false; + } } return true; diff --git a/Code/Logger.cs b/Code/Logger.cs index 39215c3..6f4c234 100644 --- a/Code/Logger.cs +++ b/Code/Logger.cs @@ -14,6 +14,7 @@ namespace Flowframes { public static TextBox textbox; static string file; + public const string defaultLogName = "sessionlog.txt"; public static void Log(string s, bool hidden = false, bool replaceLastLine = false, string filename = "") { @@ -40,7 +41,7 @@ namespace Flowframes public static void LogToFile(string s, bool noLineBreak, string filename) { if (string.IsNullOrWhiteSpace(filename)) - filename = "sessionlog.txt"; + filename = defaultLogName; file = Path.Combine(Paths.GetLogPath(), filename); diff --git a/Code/Program.cs b/Code/Program.cs index e1fcbda..0d5e0ff 100644 --- a/Code/Program.cs +++ b/Code/Program.cs @@ -12,8 +12,6 @@ namespace Flowframes { static class Program { - //public const int version = 18; - public static Form1 mainForm; public static bool busy = false;