/// <summary> /// Loads the configuration file. /// </summary> public void Load(FileSystem fileSystem) { try { FileSystem = fileSystem; Settings = new Settings(); MacroParser = new MacroParser(Settings); string configDirectory = FileSystem.GetDirectoryName(FileSystem.ConfigFile); if (!string.IsNullOrEmpty(configDirectory) && !FileSystem.DirectoryExists(configDirectory)) { FileSystem.CreateDirectory(configDirectory); } if (!FileSystem.FileExists(FileSystem.ConfigFile)) { string[] linesToWrite = { "# Auto Screen Capture Configuration File", "# Use this file to tell the application what folders and files it should utilize.", "# Each key-value pair can be the name of a folder or file or a path to a folder or file.", "# If only the folder name is given then it will be parsed as the sub-folder of the folder", "# where the executed autoscreen.exe binary is located.", "", "# This is the folder where screenshots will be stored by default.", "ScreenshotsFolder=" + FileSystem.DefaultScreenshotsFolder, "", "# If any errors are encountered then you will find them in this folder when DebugMode is enabled.", "DebugFolder=" + FileSystem.DefaultDebugFolder, "", "# Logs are stored in this folder when either Logging or DebugMode is enabled.", "LogsFolder=" + FileSystem.DefaultLogsFolder, "", "# This file is monitored by the application for commands issued from the command line while it's running.", "CommandFile=" + FileSystem.DefaultCommandFile, "", "# The application settings (such as DebugMode).", "ApplicationSettingsFile=" + FileSystem.DefaultApplicationSettingsFile, "", "# Your personal settings.", "UserSettingsFile=" + FileSystem.DefaultUserSettingsFile, "", "# SMTP settings for emailing screenshots using an email server.", "SMTPSettingsFile=" + FileSystem.DefaultSmtpSettingsFile, "", "# SFTP settings for uploading screenshots to a file server.", "SFTPSettingsFile=" + FileSystem.DefaultSftpSettingsFile, "", "# References to image editors.", "EditorsFile=" + FileSystem.DefaultEditorsFile, "", "# References to regions.", "RegionsFile=" + FileSystem.DefaultRegionsFile, "", "# References to screens.", "ScreensFile=" + FileSystem.DefaultScreensFile, "", "# References to triggers.", "TriggersFile=" + FileSystem.DefaultTriggersFile, "", "# References to screenshots.", "ScreenshotsFile=" + FileSystem.DefaultScreenshotsFile, "", "# References to tags.", "TagsFile=" + FileSystem.DefaultTagsFile, "", "# References to schedules.", "SchedulesFile=" + FileSystem.DefaultSchedulesFile, "" }; FileSystem.WriteToFile(FileSystem.ConfigFile, linesToWrite); } foreach (string line in FileSystem.ReadFromFile(FileSystem.ConfigFile)) { if (string.IsNullOrEmpty(line) || line.StartsWith("#")) { continue; } string path; if (GetPathAndCreateIfNotFound(line, REGEX_SCREENSHOTS_FOLDER, out path)) { FileSystem.ScreenshotsFolder = path; } if (GetPathAndCreateIfNotFound(line, REGEX_DEBUG_FOLDER, out path)) { FileSystem.DebugFolder = path; } if (GetPathAndCreateIfNotFound(line, REGEX_LOGS_FOLDER, out path)) { FileSystem.LogsFolder = path; } if (GetPathAndCreateIfNotFound(line, REGEX_COMMAND_FILE, out path)) { FileSystem.CommandFile = path; } if (GetPathAndCreateIfNotFound(line, REGEX_APPLICATION_SETTINGS_FILE, out path)) { FileSystem.ApplicationSettingsFile = path; } if (GetPathAndCreateIfNotFound(line, REGEX_SMTP_SETTINGS_FILE, out path)) { FileSystem.SmtpSettingsFile = path; } if (GetPathAndCreateIfNotFound(line, REGEX_SFTP_SETTINGS_FILE, out path)) { FileSystem.SftpSettingsFile = path; } if (GetPathAndCreateIfNotFound(line, REGEX_USER_SETTINGS_FILE, out path)) { FileSystem.UserSettingsFile = path; } if (GetPathAndCreateIfNotFound(line, REGEX_EDITORS_FILE, out path)) { FileSystem.EditorsFile = path; } if (GetPathAndCreateIfNotFound(line, REGEX_REGIONS_FILE, out path)) { FileSystem.RegionsFile = path; } if (GetPathAndCreateIfNotFound(line, REGEX_SCREENS_FILE, out path)) { FileSystem.ScreensFile = path; } if (GetPathAndCreateIfNotFound(line, REGEX_TRIGGERS_FILE, out path)) { FileSystem.TriggersFile = path; } if (GetPathAndCreateIfNotFound(line, REGEX_SCREENSHOTS_FILE, out path)) { FileSystem.ScreenshotsFile = path; } if (GetPathAndCreateIfNotFound(line, REGEX_TAGS_FILE, out path)) { FileSystem.TagsFile = path; } if (GetPathAndCreateIfNotFound(line, REGEX_SCHEDULES_FILE, out path)) { FileSystem.SchedulesFile = path; } } CheckAndCreateFolders(); Settings.Load(FileSystem); Log = new Log(Settings, FileSystem, MacroParser); ScreenCapture = new ScreenCapture(this, MacroParser, FileSystem, Log); Security security = new Security(); CheckAndCreateFiles(security, ScreenCapture, Log); } catch (Exception ex) { Log.WriteExceptionMessage("Config::Load", ex); } }
/// <summary> /// Loads the configuration file. /// </summary> public static void Load() { try { if (!FileSystem.DirectoryExists(FileSystem.GetDirectoryName(FileSystem.ConfigFile))) { FileSystem.CreateDirectory(FileSystem.GetDirectoryName(FileSystem.ConfigFile)); } if (!FileSystem.FileExists(FileSystem.ConfigFile)) { string[] linesToWrite = { "# Auto Screen Capture Configuration File", "# Use this file to tell the application what folders and files it should utilize.", "# Each key-value pair can be the name of a folder or file or a path to a folder or file.", "# If only the folder name is given then it will be parsed as the sub-folder of the folder", "# where the executed autoscreen.exe binary is located.", "", "# This is the folder where screenshots will be stored by default.", "ScreenshotsFolder=" + FileSystem.DefaultScreenshotsFolder, "", "# If any errors are encountered then you will find them in this folder when DebugMode is enabled.", "DebugFolder=" + FileSystem.DefaultDebugFolder, "", "# Logs are stored in this folder when either Logging or DebugMode is enabled.", "LogsFolder=" + FileSystem.DefaultLogsFolder, "", "# This file is monitored by the application for commands issued from the command line while it's running.", "CommandFile=" + FileSystem.DefaultCommandFile, "", "# The application settings (such as DebugMode).", "ApplicationSettingsFile=" + FileSystem.DefaultApplicationSettingsFile, "", "# Your personal settings.", "UserSettingsFile=" + FileSystem.DefaultUserSettingsFile, "", "# References to image editors.", "EditorsFile=" + FileSystem.DefaultEditorsFile, "", "# References to regions.", "RegionsFile=" + FileSystem.DefaultRegionsFile, "", "# References to screens.", "ScreensFile=" + FileSystem.DefaultScreensFile, "", "# References to triggers.", "TriggersFile=" + FileSystem.DefaultTriggersFile, "", "# References to screenshots.", "ScreenshotsFile=" + FileSystem.DefaultScreenshotsFile, "", "# References to tags.", "TagsFile=" + FileSystem.DefaultTagsFile, "", "# References to schedules.", "SchedulesFile=" + FileSystem.DefaultSchedulesFile, "" }; FileSystem.WriteToFile(FileSystem.ConfigFile, linesToWrite); } foreach (string line in FileSystem.ReadFromFile(FileSystem.ConfigFile)) { string path; if (GetPath(line, REGEX_SCREENSHOTS_FOLDER, out path)) { FileSystem.ScreenshotsFolder = path; } if (GetPath(line, REGEX_DEBUG_FOLDER, out path)) { FileSystem.DebugFolder = path; } if (GetPath(line, REGEX_LOGS_FOLDER, out path)) { FileSystem.LogsFolder = path; } if (GetPath(line, REGEX_COMMAND_FILE, out path)) { FileSystem.CommandFile = path; } if (GetPath(line, REGEX_APPLICATION_SETTINGS_FILE, out path)) { FileSystem.ApplicationSettingsFile = path; } if (GetPath(line, REGEX_USER_SETTINGS_FILE, out path)) { FileSystem.UserSettingsFile = path; } if (GetPath(line, REGEX_EDITORS_FILE, out path)) { FileSystem.EditorsFile = path; } if (GetPath(line, REGEX_REGIONS_FILE, out path)) { FileSystem.RegionsFile = path; } if (GetPath(line, REGEX_SCREENS_FILE, out path)) { FileSystem.ScreensFile = path; } if (GetPath(line, REGEX_TRIGGERS_FILE, out path)) { FileSystem.TriggersFile = path; } if (GetPath(line, REGEX_SCREENSHOTS_FILE, out path)) { FileSystem.ScreenshotsFile = path; } if (GetPath(line, REGEX_TAGS_FILE, out path)) { FileSystem.TagsFile = path; } if (GetPath(line, REGEX_SCHEDULES_FILE, out path)) { FileSystem.SchedulesFile = path; } } CheckAndCreateFolders(); CheckAndCreateFiles(); } catch (Exception ex) { Log.WriteExceptionMessage("Config::Load", ex); } }
/// <summary> /// Parses the command line and processes the commands the user has chosen from the command line. /// </summary> /// <param name="args"></param> private void ParseCommandLineArguments(string[] args) { try { // Clear the contents of the command file before parsing the command line arguments. // We have the commands in "args" already and, to prevent commands like -exit screwing up // the application's ability to read commands on the next run, we need to make sure that the // command file is empty at this point in time. We don't want to be taking screenshots every // second just because the -capture command was left remaining in the command file! // // Also, this ensures that a sensitive command such as the -passphrase=x command is // immediately removed from the file. FileSystem.WriteToFile(FileSystem.CommandFile, string.Empty); ScreenCapture.AutoStartFromCommandLine = Convert.ToBoolean(Settings.Application.GetByKey("AutoStartFromCommandLine", DefaultSettings.AutoStartFromCommandLine).Value); // Create the "Special Schedule" if it doesn't already exist. if (_formSchedule.ScheduleCollection.GetByName(ScheduleCollection.SpecialScheduleName) == null) { DateTime dtNow = DateTime.Now; Schedule specialSchedule = new Schedule() { Name = ScheduleCollection.SpecialScheduleName, Active = false, ModeOneTime = true, ModePeriod = false, CaptureAt = dtNow, StartAt = dtNow, StopAt = dtNow, ScreenCaptureInterval = DefaultSettings.ScreenCaptureInterval, Notes = "This schedule is used for the command line arguments -captureat, -startat, and -stopat." }; _formSchedule.ScheduleCollection.Add(specialSchedule); BuildSchedulesModule(); if (!_formSchedule.ScheduleCollection.SaveToXmlFile()) { _screenCapture.ApplicationError = true; } } foreach (string arg in args) { // -debug if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_DEBUG)) { Log.DebugMode = !Log.DebugMode; Settings.Application.SetValueByKey("DebugMode", Log.DebugMode); if (!Settings.Application.Save()) { _screenCapture.ApplicationError = true; } } // -debug=on if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_DEBUG_ON)) { Log.DebugMode = true; Settings.Application.SetValueByKey("DebugMode", true); if (!Settings.Application.Save()) { _screenCapture.ApplicationError = true; } } // -debug=off if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_DEBUG_OFF)) { Log.DebugMode = false; Settings.Application.SetValueByKey("DebugMode", false); if (!Settings.Application.Save()) { _screenCapture.ApplicationError = true; } } // -log if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_LOG)) { Log.LoggingEnabled = !Log.LoggingEnabled; Settings.Application.SetValueByKey("Logging", Log.LoggingEnabled); if (!Settings.Application.Save()) { _screenCapture.ApplicationError = true; } } // -log=on if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_LOG_ON)) { Log.LoggingEnabled = true; Settings.Application.SetValueByKey("Logging", true); if (!Settings.Application.Save()) { _screenCapture.ApplicationError = true; } } // -log=off if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_LOG_OFF)) { Log.LoggingEnabled = false; Settings.Application.SetValueByKey("Logging", false); if (!Settings.Application.Save()) { _screenCapture.ApplicationError = true; } } // -capture if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_CAPTURE)) { TakeScreenshot(captureNow: true); } // -start if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_START)) { StartScreenCapture(); return; } // -stop if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_STOP)) { StopScreenCapture(); return; } // -exit if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_EXIT)) { ExitApplication(); } // -showSystemTrayIcon if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_SHOW_SYSTEM_TRAY_ICON)) { Settings.User.SetValueByKey("ShowSystemTrayIcon", true); if (!Settings.User.Save()) { _screenCapture.ApplicationError = true; } notifyIcon.Visible = true; } // -hideSystemTrayIcon if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_HIDE_SYSTEM_TRAY_ICON)) { Settings.User.SetValueByKey("ShowSystemTrayIcon", false); if (!Settings.User.Save()) { _screenCapture.ApplicationError = true; } notifyIcon.Visible = false; } // -initial if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_INITIAL)) { checkBoxInitialScreenshot.Checked = !checkBoxInitialScreenshot.Checked; Settings.User.SetValueByKey("TakeInitialScreenshot", checkBoxInitialScreenshot.Checked); if (!Settings.User.Save()) { _screenCapture.ApplicationError = true; } } // -initial=on if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_INITIAL_ON)) { checkBoxInitialScreenshot.Checked = true; Settings.User.SetValueByKey("TakeInitialScreenshot", true); if (!Settings.User.Save()) { _screenCapture.ApplicationError = true; } } // -initial=off if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_INITIAL_OFF)) { checkBoxInitialScreenshot.Checked = false; Settings.User.SetValueByKey("TakeInitialScreenshot", false); if (!Settings.User.Save()) { _screenCapture.ApplicationError = true; } } // -limit=x if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_LIMIT)) { int cmdLimit = Convert.ToInt32(Regex.Match(arg, CommandLineRegex.REGEX_COMMAND_LINE_LIMIT).Groups["Limit"].Value); if (cmdLimit >= CAPTURE_LIMIT_MIN && cmdLimit <= CAPTURE_LIMIT_MAX) { numericUpDownCaptureLimit.Value = cmdLimit; checkBoxCaptureLimit.Checked = true; _screenCapture.Limit = checkBoxCaptureLimit.Checked ? (int)numericUpDownCaptureLimit.Value : 0; } } // -interval=hh:mm:ss.nnn if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_INTERVAL)) { int hours = Convert.ToInt32(Regex.Match(arg, CommandLineRegex.REGEX_COMMAND_LINE_INTERVAL).Groups["Hours"].Value); int minutes = Convert.ToInt32(Regex.Match(arg, CommandLineRegex.REGEX_COMMAND_LINE_INTERVAL).Groups["Minutes"].Value); int seconds = Convert.ToInt32(Regex.Match(arg, CommandLineRegex.REGEX_COMMAND_LINE_INTERVAL).Groups["Seconds"].Value); int milliseconds = Convert.ToInt32(Regex.Match(arg, CommandLineRegex.REGEX_COMMAND_LINE_INTERVAL).Groups["Milliseconds"].Value); numericUpDownHoursInterval.Value = hours; numericUpDownMinutesInterval.Value = minutes; numericUpDownSecondsInterval.Value = seconds; numericUpDownMillisecondsInterval.Value = milliseconds; int screenCaptureInterval = GetScreenCaptureInterval(); if (screenCaptureInterval > 0) { timerScreenCapture.Stop(); timerScreenCapture.Enabled = false; _screenCapture.DateTimePreviousCycle = DateTime.Now; _screenCapture.Interval = screenCaptureInterval; timerScreenCapture.Interval = screenCaptureInterval; Settings.User.SetValueByKey("ScreenCaptureInterval", screenCaptureInterval); if (!Settings.User.Save()) { _screenCapture.ApplicationError = true; } timerScreenCapture.Enabled = true; timerScreenCapture.Start(); _formSchedule.ScheduleCollection.GetByName(ScheduleCollection.SpecialScheduleName).ScreenCaptureInterval = screenCaptureInterval; } } // -passphrase="x" if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_PASSPHRASE)) { string passphrase = Regex.Match(arg, CommandLineRegex.REGEX_COMMAND_LINE_PASSPHRASE).Groups["Passphrase"].Value; if (passphrase.Length > 0) { if (string.IsNullOrEmpty(FileSystem.UserSettingsFile)) { Config.Load(); } passphrase = passphrase.Trim(); Settings.User.SetValueByKey("Passphrase", Security.Hash(passphrase)); if (!Settings.User.Save()) { _screenCapture.ApplicationError = true; } ScreenCapture.LockScreenCaptureSession = true; } } // -startat=hh:mm:ss if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_STARTAT)) { int hours = Convert.ToInt32(Regex.Match(arg, CommandLineRegex.REGEX_COMMAND_LINE_STARTAT).Groups["Hours"].Value); int minutes = Convert.ToInt32(Regex.Match(arg, CommandLineRegex.REGEX_COMMAND_LINE_STARTAT).Groups["Minutes"].Value); int seconds = Convert.ToInt32(Regex.Match(arg, CommandLineRegex.REGEX_COMMAND_LINE_STARTAT).Groups["Seconds"].Value); _formSchedule.ScheduleCollection.GetByName(ScheduleCollection.SpecialScheduleName).Active = true; _formSchedule.ScheduleCollection.GetByName(ScheduleCollection.SpecialScheduleName).ModeOneTime = false; _formSchedule.ScheduleCollection.GetByName(ScheduleCollection.SpecialScheduleName).ModePeriod = true; _formSchedule.ScheduleCollection.GetByName(ScheduleCollection.SpecialScheduleName).StartAt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, hours, minutes, seconds); ApplyDayForSpecialSchedule(); BuildSchedulesModule(); if (!_formSchedule.ScheduleCollection.SaveToXmlFile()) { _screenCapture.ApplicationError = true; } } // -stopat=hh:mm:ss if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_STOPAT)) { int hours = Convert.ToInt32(Regex.Match(arg, CommandLineRegex.REGEX_COMMAND_LINE_STOPAT).Groups["Hours"].Value); int minutes = Convert.ToInt32(Regex.Match(arg, CommandLineRegex.REGEX_COMMAND_LINE_STOPAT).Groups["Minutes"].Value); int seconds = Convert.ToInt32(Regex.Match(arg, CommandLineRegex.REGEX_COMMAND_LINE_STOPAT).Groups["Seconds"].Value); _formSchedule.ScheduleCollection.GetByName(ScheduleCollection.SpecialScheduleName).Active = true; _formSchedule.ScheduleCollection.GetByName(ScheduleCollection.SpecialScheduleName).ModeOneTime = false; _formSchedule.ScheduleCollection.GetByName(ScheduleCollection.SpecialScheduleName).ModePeriod = true; _formSchedule.ScheduleCollection.GetByName(ScheduleCollection.SpecialScheduleName).StopAt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, hours, minutes, seconds); ApplyDayForSpecialSchedule(); BuildSchedulesModule(); if (!_formSchedule.ScheduleCollection.SaveToXmlFile()) { _screenCapture.ApplicationError = true; } } // -captureat=hh:mm:ss if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_CAPTUREAT)) { int hours = Convert.ToInt32(Regex.Match(arg, CommandLineRegex.REGEX_COMMAND_LINE_CAPTUREAT).Groups["Hours"].Value); int minutes = Convert.ToInt32(Regex.Match(arg, CommandLineRegex.REGEX_COMMAND_LINE_CAPTUREAT).Groups["Minutes"].Value); int seconds = Convert.ToInt32(Regex.Match(arg, CommandLineRegex.REGEX_COMMAND_LINE_CAPTUREAT).Groups["Seconds"].Value); _formSchedule.ScheduleCollection.GetByName(ScheduleCollection.SpecialScheduleName).Active = true; _formSchedule.ScheduleCollection.GetByName(ScheduleCollection.SpecialScheduleName).ModeOneTime = true; _formSchedule.ScheduleCollection.GetByName(ScheduleCollection.SpecialScheduleName).ModePeriod = false; _formSchedule.ScheduleCollection.GetByName(ScheduleCollection.SpecialScheduleName).CaptureAt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, hours, minutes, seconds); ApplyDayForSpecialSchedule(); BuildSchedulesModule(); if (!_formSchedule.ScheduleCollection.SaveToXmlFile()) { _screenCapture.ApplicationError = true; } } // -activeWindowTitle="x" if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_ACTIVE_WINDOW_TITLE)) { string activeWindowTitle = Regex.Match(arg, CommandLineRegex.REGEX_COMMAND_LINE_ACTIVE_WINDOW_TITLE).Groups["ActiveWindowTitle"].Value; if (activeWindowTitle.Length > 0) { if (string.IsNullOrEmpty(FileSystem.UserSettingsFile)) { Config.Load(); } activeWindowTitle = activeWindowTitle.Trim(); Settings.User.SetValueByKey("ActiveWindowTitleCaptureCheck", true); Settings.User.SetValueByKey("ActiveWindowTitleCaptureText", activeWindowTitle); if (!Settings.User.Save()) { _screenCapture.ApplicationError = true; } checkBoxActiveWindowTitle.Checked = true; textBoxActiveWindowTitle.Text = activeWindowTitle; _screenCapture.ActiveWindowTitle = activeWindowTitle; } } // -applicationFocus="x" if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_APPLICATION_FOCUS)) { string applicationFocus = Regex.Match(arg, CommandLineRegex.REGEX_COMMAND_LINE_APPLICATION_FOCUS).Groups["ApplicationFocus"].Value; if (applicationFocus.Length > 0) { if (string.IsNullOrEmpty(FileSystem.UserSettingsFile)) { Config.Load(); } applicationFocus = applicationFocus.Trim(); Settings.User.SetValueByKey("ApplicationFocus", applicationFocus); if (!Settings.User.Save()) { _screenCapture.ApplicationError = true; } RefreshApplicationFocusList(); } } // -label="x" if (Regex.IsMatch(arg, CommandLineRegex.REGEX_COMMAND_LINE_LABEL)) { string label = Regex.Match(arg, CommandLineRegex.REGEX_COMMAND_LINE_LABEL).Groups["Label"].Value; if (label.Length > 0) { if (string.IsNullOrEmpty(FileSystem.UserSettingsFile)) { Config.Load(); } label = label.Trim(); Settings.User.SetValueByKey("ApplyScreenshotLabel", true); Settings.User.SetValueByKey("ScreenshotLabel", label); if (!Settings.User.Save()) { _screenCapture.ApplicationError = true; } checkBoxScreenshotLabel.Checked = true; comboBoxScreenshotLabel.Text = label; } } } if (ScreenCapture.AutoStartFromCommandLine) { StartScreenCapture(); } } catch (Exception ex) { _screenCapture.ApplicationError = true; Log.WriteExceptionMessage("FormMain-CommandLine::ParseCommandLineArguments", ex); } }