Skip to content

Commit 4704b78

Browse files
committed
Allow to exclude forms from Softlock
Fixes #14
1 parent 9450a50 commit 4704b78

File tree

3 files changed

+34
-6
lines changed

3 files changed

+34
-6
lines changed

src/Config/LockAssistConfig_SL.cs

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,48 @@ public static bool SL_OnMinimize
5151
set { _config.SetBool(LockAssistSoftlockOnMinimize, value); }
5252
}
5353

54+
private static List<string> m_SL_DefaultExcludeForms = new List<string>() {"AboutForm","AutoTypeCtxForm","CharPickerForm","ColumnsForm",
55+
"HelpSourceForm","KeyPromptForm","LanguageForm","PluginsForm","PwGeneratorForm","UpdateCheckForm", "OtpKeyProv.Forms.OtpKeyPromptForm" };
56+
private const string mc_ExcludeFormsText = "Enter form names to exclude from Softlock";
5457
public static List<string> SL_ExcludeForms
5558
{
5659
get
5760
{
58-
string sForms = _config.GetString(LockAssistSoftlockExcludeForms, "AboutForm,AutoTypeCtxForm,CharPickerForm,ColumnsForm," +
59-
"HelpSourceForm,KeyPromptForm,LanguageForm,PluginsForm,PwGeneratorForm,UpdateCheckForm");
60-
var aForms = sForms.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
61+
//Set defaults
6162
List<string> lForms = new List<string>();
63+
lForms.AddRange(m_SL_DefaultExcludeForms);
64+
65+
string sForms = _config.GetString(LockAssistSoftlockExcludeForms, string.Empty);
66+
if (string.IsNullOrEmpty(sForms))
67+
{
68+
sForms = string.Empty;
69+
SL_ExcludeForms = new List<string>() { mc_ExcludeFormsText };
70+
}
71+
var aForms = sForms.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
6272
foreach (var sForm in aForms)
6373
{
74+
if (sForm == mc_ExcludeFormsText) continue;
75+
if (sForm.Trim().StartsWith("-")) continue;
6476
if (!lForms.Contains(sForm.Trim())) lForms.Add(sForm.Trim());
6577
}
78+
foreach (var sForm in aForms)
79+
{
80+
if (sForm == mc_ExcludeFormsText) continue;
81+
if (!sForm.Trim().StartsWith("-")) continue;
82+
lForms.Remove(sForm.Trim().Substring(1));
83+
}
6684
return lForms;
6785
}
86+
set
87+
{
88+
string sForms = string.Empty;
89+
foreach (var s in value)
90+
{
91+
if (!string.IsNullOrEmpty(sForms)) sForms += ",";
92+
sForms += s;
93+
}
94+
_config.SetString(LockAssistSoftlockExcludeForms, sForms);
95+
}
6896
}
6997
}
7098
}

src/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
3333
// indem Sie "*" wie unten gezeigt eingeben:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("3.3.1")]
36-
[assembly: AssemblyFileVersion("3.3.1")]
35+
[assembly: AssemblyVersion("3.4")]
36+
[assembly: AssemblyFileVersion("3.4")]

version.info

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
:
2-
LockAssist:3.3.1
2+
LockAssist:3.4
33
LockAssist!de:5
44
LockAssist!pt:4
55
:

0 commit comments

Comments
 (0)