From 0b0f859be940a5a127130912911e2feaf6076402 Mon Sep 17 00:00:00 2001 From: Richard Date: Sat, 13 Feb 2021 02:19:03 +0100 Subject: [PATCH 1/2] input from launch argument support --- Code/Form1.cs | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/Code/Form1.cs b/Code/Form1.cs index 576a258..2e3655c 100644 --- a/Code/Form1.cs +++ b/Code/Form1.cs @@ -6,6 +6,7 @@ using Flowframes.OS; using Flowframes.UI; using Microsoft.WindowsAPICodePack.Dialogs; using System; +using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.IO; @@ -15,6 +16,7 @@ using HTAlt.WinForms; using Flowframes.Data; using Microsoft.WindowsAPICodePack.Taskbar; using System.Threading.Tasks; +using System.Windows.Documents; using Flowframes.MiscUtils; namespace Flowframes @@ -53,6 +55,8 @@ namespace Flowframes Initialized(); Checks(); + + HandleArguments(); } void Checks() @@ -67,7 +71,27 @@ namespace Flowframes catch (Exception e) { Logger.Log("Non-critical error while performing online checks. See logs for details."); - Logger.Log(e.Message + "\n" + e.StackTrace, true); + Logger.Log($"{e.Message} \n {e.StackTrace}", true); + } + } + + void HandleArguments() + { + try + { + string[] args = Environment.GetCommandLineArgs(); + List files = new List(); + foreach (string arg in args) + if (IOUtils.IsFileValid(arg)) + files.Add(arg); + files.RemoveAt(0); // remove flowframes executable + if(files.Count > 0) + DragDropHandler(files.ToArray()); + } + catch (Exception e) + { + Logger.Log($"Failed to load input from given launch arguments."); + Logger.Log($"{e.Message} \n {e.StackTrace}", true); } } From 9de82415edc48519c348a3e321fe5517c299a342 Mon Sep 17 00:00:00 2001 From: Richard Date: Sat, 13 Feb 2021 02:29:00 +0100 Subject: [PATCH 2/2] remove spaces --- Code/Form1.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Form1.cs b/Code/Form1.cs index 2e3655c..b00f708 100644 --- a/Code/Form1.cs +++ b/Code/Form1.cs @@ -71,7 +71,7 @@ namespace Flowframes catch (Exception e) { Logger.Log("Non-critical error while performing online checks. See logs for details."); - Logger.Log($"{e.Message} \n {e.StackTrace}", true); + Logger.Log($"{e.Message}\n{e.StackTrace}", true); } } @@ -91,7 +91,7 @@ namespace Flowframes catch (Exception e) { Logger.Log($"Failed to load input from given launch arguments."); - Logger.Log($"{e.Message} \n {e.StackTrace}", true); + Logger.Log($"{e.Message}\n{e.StackTrace}", true); } }