From 4b5d73494a6a967edf3bca13f8e5b47670147258 Mon Sep 17 00:00:00 2001 From: Jorg Tretter Date: Fri, 11 Dec 2020 07:27:07 -0600 Subject: [PATCH] Add option to be silent on errors. --- SShot/Program.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/SShot/Program.cs b/SShot/Program.cs index 1d27274..06bb9de 100644 --- a/SShot/Program.cs +++ b/SShot/Program.cs @@ -14,15 +14,15 @@ namespace SShot /// The main entry point for the application. /// [STAThread] - static void Main() + static void Main(string[] args) { string fileName = DateTime.Now.ToString("u").Replace("Z", ".png").Replace(":", "-"); string dirName = DateTime.Now.ToString("u").Substring(0, 10); System.IO.Directory.CreateDirectory(dirName); - captureScreen(dirName + "\\" + fileName); + captureScreen(dirName + "\\" + fileName, args); } - private static void captureScreen(String filename) + private static void captureScreen(String filename, string[] args) { try { @@ -34,7 +34,11 @@ namespace SShot } catch (Exception ex) { - MessageBox.Show(ex.Message); + if (args.Length > 0) { + if (args[0] != "-QietErrors") { + MessageBox.Show(ex.Message); + } + } } }