Skip to content

Commit 44ae0c1

Browse files
committed
2.3.4.7 - SaveScreenshotRefs user setting introduced. Implemented command line options -saveScreenshotRefs=on and -saveScreenshotRefs=off.
1 parent 5b46a7d commit 44ae0c1

File tree

9 files changed

+72
-30
lines changed

9 files changed

+72
-30
lines changed

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("2.3.4.6")]
36-
[assembly: AssemblyFileVersion("2.3.4.6")]
35+
[assembly: AssemblyVersion("2.3.4.7")]
36+
[assembly: AssemblyFileVersion("2.3.4.7")]
3737
[assembly: NeutralResourcesLanguageAttribute("en-CA")]

app.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<assemblyIdentity
44
type="win32"
55
name="GavinKendall.AutoScreenCapture"
6-
version="2.3.4.6"/>
6+
version="2.3.4.7"/>
77
<asmv3:application>
88
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
99
<dpiAware>True/PM</dpiAware>

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Auto Screen Capture by Gavin Kendall
44

55

66
Codename "Boombayah"
7+
2.3.4.7 SaveScreenshotRefs user setting introduced. Implemented command line options -saveScreenshotRefs=on and -saveScreenshotRefs=off.
78
2.3.4.6 Fixed Show/Hide Interface bug so you no longer need to select the option twice to show the interface on initial startup. AutoStartFromCommandLine is temporarily disabled when command line options -stop, -exit, -startat, -stopat, or -captureat are provided.
89
2.3.4.5 "Keep screenshots for X days" trigger is now inactive by default to avoid potential data loss.
910
2.3.4.4 Fix to Screen Capture method (again).

interface/FormAbout.resx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119119
</resheader>
120120
<data name="richTextBoxApplication.Text" xml:space="preserve">
121-
<value>Auto Screen Capture 2.3.4.6 ("Boombayah")
121+
<value>Auto Screen Capture 2.3.4.7 ("Boombayah")
122122
Developed by Gavin Kendall (2008 - 2021)
123123

124124
SourceForge Project Site
@@ -140,6 +140,7 @@ Triggers have been rewritten. I haven't spent much time on the new wizard-style
140140
</data>
141141
<data name="richTextBoxChangelog.Text" xml:space="preserve">
142142
<value>Codename "Boombayah"
143+
2.3.4.7 SaveScreenshotRefs user setting introduced. Implemented command line options -saveScreenshotRefs=on and -saveScreenshotRefs=off.
143144
2.3.4.6 Fixed Show/Hide Interface bug so you no longer need to select the option twice to show the interface on initial startup. AutoStartFromCommandLine is temporarily disabled when command line options -stop, -exit, -startat, -stopat, or -captureat are provided.
144145
2.3.4.5 "Keep screenshots for X days" trigger is now inactive by default to avoid potential data loss.
145146
2.3.4.4 Fix to Screen Capture method (again).

interface/main/FormMain-CommandLine.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,16 @@ public partial class FormMain : Form
161161
/// </summary>
162162
internal const string REGEX_COMMAND_LINE_APPLICATION_FOCUS_DELAY_AFTER = @"^-applicationFocusDelayAfter=(?<ApplicationFocusDelayAfter>\d{1,5})$";
163163

164+
/// <summary>
165+
/// Regex for parsing the -saveScreenshotRefs=on command.
166+
/// </summary>
167+
internal const string REGEX_COMMAND_LINE_SAVE_SCREENSHOT_REFS_ON = "^-saveScreenshotRefs=on$";
168+
169+
/// <summary>
170+
/// Regex for parsing the -saveScreenshotRefs=off command.
171+
/// </summary>
172+
internal const string REGEX_COMMAND_LINE_SAVE_SCREENSHOT_REFS_OFF = "^-saveScreenshotRefs=off$";
173+
164174
/// <summary>
165175
/// Parses the command line and processes the commands the user has chosen from the command line.
166176
/// </summary>
@@ -608,6 +618,28 @@ private void ParseCommandLineArguments(string[] args)
608618

609619
numericUpDownApplicationFocusDelayAfter.Value = delayAfter;
610620
}
621+
622+
// -saveScreenshotRefs=on
623+
if (Regex.IsMatch(arg, REGEX_COMMAND_LINE_SAVE_SCREENSHOT_REFS_ON))
624+
{
625+
_config.Settings.User.SetValueByKey("SaveScreenshotRefs", true);
626+
627+
if (!_config.Settings.User.Save(_config.Settings, _fileSystem))
628+
{
629+
_screenCapture.ApplicationError = true;
630+
}
631+
}
632+
633+
// -saveScreenshotRefs=off
634+
if (Regex.IsMatch(arg, REGEX_COMMAND_LINE_SAVE_SCREENSHOT_REFS_OFF))
635+
{
636+
_config.Settings.User.SetValueByKey("SaveScreenshotRefs", false);
637+
638+
if (!_config.Settings.User.Save(_config.Settings, _fileSystem))
639+
{
640+
_screenCapture.ApplicationError = true;
641+
}
642+
}
611643
}
612644

613645
if (_screenCapture.AutoStartFromCommandLine)

interface/main/FormMain.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -344,16 +344,12 @@ private void ShowInterface()
344344
_config.Settings.User.GetByKey("Passphrase", _config.Settings.DefaultSettings.Passphrase).Value = string.Empty;
345345
SaveSettings();
346346

347-
Opacity = 100;
348-
349347
SearchDates();
350348
SearchScreenshots();
351349

352350
PopulateLabelList();
353351

354-
Show();
355-
356-
Visible = true;
352+
Opacity = 100;
357353
ShowInTaskbar = true;
358354

359355
// If the window is mimimized then show it when the user wants to open the window.
@@ -362,8 +358,6 @@ private void ShowInterface()
362358
WindowState = FormWindowState.Normal;
363359
}
364360

365-
Focus();
366-
367361
_log.WriteDebugMessage("Running triggers of condition type InterfaceShowing");
368362
RunTriggersOfConditionType(TriggerConditionType.InterfaceShowing);
369363
}
@@ -385,9 +379,6 @@ private void HideInterface()
385379
_log.WriteDebugMessage("Hiding interface");
386380

387381
Opacity = 0;
388-
389-
Hide();
390-
Visible = false;
391382
ShowInTaskbar = false;
392383

393384
_log.WriteDebugMessage("Running triggers of condition type InterfaceHiding");

modules/screenshots/ScreenshotCollection.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,13 @@ public void SaveToXmlFile(Config config)
883883
{
884884
try
885885
{
886+
bool saveScreenshotRefs = Convert.ToBoolean(config.Settings.User.GetByKey("SaveScreenshotRefs", config.Settings.DefaultSettings.SaveScreenshotRefs).Value);
887+
888+
if (!saveScreenshotRefs)
889+
{
890+
return;
891+
}
892+
886893
_mutexWriteFile.WaitOne();
887894

888895
if (string.IsNullOrEmpty(_fileSystem.ScreenshotsFile))

settings/DefaultSettings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public class DefaultSettings
7474
internal readonly int ApplicationFocusDelayBefore = 0;
7575
internal readonly int ApplicationFocusDelayAfter = 0;
7676
internal readonly int ActiveWindowTitleMatchType = 2;
77+
internal readonly bool SaveScreenshotRefs = true;
7778

7879
// Keyboard Shortcuts.
7980
internal readonly bool UseKeyboardShortcuts = false;

settings/Settings.cs

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ public void Load(FileSystem fileSystem)
225225
_versionCollection.Add(new Version(CODENAME_BOOMBAYAH, "2.3.4.3")); // Fix to Screen Capture method.
226226
_versionCollection.Add(new Version(CODENAME_BOOMBAYAH, "2.3.4.4")); // Fix to Screen Capture method (again).
227227
_versionCollection.Add(new Version(CODENAME_BOOMBAYAH, "2.3.4.5")); // "Keep screenshots for X days" trigger is now inactive by default to avoid potential data loss.
228+
_versionCollection.Add(new Version(CODENAME_BOOMBAYAH, "2.3.4.6")); // Fixed Show/Hide Interface bug so you no longer need to select the option twice to show the interface on initial startup. AutoStartFromCommandLine is temporarily disabled when command line options -stop, -exit, -startat, -stopat, or -captureat are provided.
228229

229230
Application = new SettingCollection()
230231
{
@@ -397,6 +398,7 @@ public void Load(FileSystem fileSystem)
397398
User.Add(new Setting("KeyboardShortcutRegionSelectEditModifier2", DefaultSettings.KeyboardShortcutRegionSelectEditModifier2));
398399
User.Add(new Setting("KeyboardShortcutRegionSelectEditKey", DefaultSettings.KeyboardShortcutRegionSelectEditKey));
399400
User.Add(new Setting("ActiveWindowTitleMatchType", DefaultSettings.ActiveWindowTitleMatchType));
401+
User.Add(new Setting("SaveScreenshotRefs", DefaultSettings.SaveScreenshotRefs));
400402
User.Save(this, fileSystem);
401403
}
402404

@@ -576,24 +578,31 @@ public void UpgradeUserSettings(SettingCollection settingCollection, ScreenCaptu
576578
}
577579

578580
var versionInConfig = new Version(settingCollection.AppCodename, settingCollection.AppVersion, false);
581+
Version v2346 = VersionManager.Versions.Get(CODENAME_BOOMBAYAH, "2.3.4.6");
582+
583+
// SaveScreenshotRefs is a new user setting as of 2.3.4.7 so make sure to add it for older versions.
584+
if (v2346 != null && versionInConfig != null && versionInConfig.VersionNumber <= v2346.VersionNumber)
585+
{
586+
User.Add(new Setting("SaveScreenshotRefs", DefaultSettings.SaveScreenshotRefs));
587+
}
579588

580589
if (versionInConfig.VersionString.Equals("2.2.0.0") ||
581-
versionInConfig.VersionString.Equals("2.2.0.1") ||
582-
versionInConfig.VersionString.Equals("2.2.0.2") ||
583-
versionInConfig.VersionString.Equals("2.2.0.3") ||
584-
versionInConfig.VersionString.Equals("2.2.0.4") ||
585-
versionInConfig.VersionString.Equals("2.2.0.5") ||
586-
versionInConfig.VersionString.Equals("2.2.0.6") ||
587-
versionInConfig.VersionString.Equals("2.2.0.7") ||
588-
versionInConfig.VersionString.Equals("2.2.0.8") ||
589-
versionInConfig.VersionString.Equals("2.2.0.9") ||
590-
versionInConfig.VersionString.Equals("2.2.0.10") ||
591-
versionInConfig.VersionString.Equals("2.2.0.11") ||
592-
versionInConfig.VersionString.Equals("2.2.0.12") ||
593-
versionInConfig.VersionString.Equals("2.2.0.13") ||
594-
versionInConfig.VersionString.Equals("2.2.0.14") ||
595-
versionInConfig.VersionString.Equals("2.2.0.15") ||
596-
versionInConfig.VersionString.Equals("2.2.0.16"))
590+
versionInConfig.VersionString.Equals("2.2.0.1") ||
591+
versionInConfig.VersionString.Equals("2.2.0.2") ||
592+
versionInConfig.VersionString.Equals("2.2.0.3") ||
593+
versionInConfig.VersionString.Equals("2.2.0.4") ||
594+
versionInConfig.VersionString.Equals("2.2.0.5") ||
595+
versionInConfig.VersionString.Equals("2.2.0.6") ||
596+
versionInConfig.VersionString.Equals("2.2.0.7") ||
597+
versionInConfig.VersionString.Equals("2.2.0.8") ||
598+
versionInConfig.VersionString.Equals("2.2.0.9") ||
599+
versionInConfig.VersionString.Equals("2.2.0.10") ||
600+
versionInConfig.VersionString.Equals("2.2.0.11") ||
601+
versionInConfig.VersionString.Equals("2.2.0.12") ||
602+
versionInConfig.VersionString.Equals("2.2.0.13") ||
603+
versionInConfig.VersionString.Equals("2.2.0.14") ||
604+
versionInConfig.VersionString.Equals("2.2.0.15") ||
605+
versionInConfig.VersionString.Equals("2.2.0.16"))
597606
{
598607
if (settingCollection.KeyExists("StringPassphrase"))
599608
{

0 commit comments

Comments
 (0)