Skip to content

Commit

Permalink
Merge pull request #37 from FlexConfirmMail/support-default-config-fi…
Browse files Browse the repository at this point in the history
…les-v22.4

Add default configuration files for v22.4
  • Loading branch information
piroor authored Sep 26, 2024
2 parents 567d2f7 + 1a5ef73 commit 890fa61
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
5 changes: 5 additions & 0 deletions Config/Const.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ public class RegistryPath
public static readonly string Policy = @"SOFTWARE\Policies\FlexConfirmMail";
}

public class ConfigPath
{
public static readonly string DefaultConfigDirName = @"DefaultConfig";
}

public enum ConfigOption
{
CountEnabled,
Expand Down
7 changes: 6 additions & 1 deletion Config/StandardPath.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;

using System.IO;

namespace FlexConfirmMail
Expand All @@ -10,6 +9,12 @@ public static string GetUserDir()
{
string appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
return Path.Combine(appData, Global.AppName);
}

public static string GetDefaultConfigDir()
{
string dllDirectory = AppDomain.CurrentDomain.BaseDirectory;
return Path.Combine(dllDirectory, ConfigPath.DefaultConfigDirName);
}
}
}
5 changes: 4 additions & 1 deletion Dialog/ConfigDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ public ConfigDialog()
{
_default = Loader.LoadFromReg(RegistryPath.DefaultPolicy);
_config.Merge(_default);
}
}
Config defaultWithFile = Loader.LoadFromDir(StandardPath.GetDefaultConfigDir());
_default.Merge(defaultWithFile);
_config.Merge(defaultWithFile);

_local = Loader.LoadFromDir(StandardPath.GetUserDir());
_config.Merge(_local);
Expand Down
1 change: 1 addition & 0 deletions FlexConfirmMail.iss
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ Source: "bin\Release\zh\FlexConfirmMail.resources.dll"; DestDir: "{app}\zh"; Fla
Source: "bin\Release\Microsoft.Office.Tools.Common.v4.0.Utilities.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "bin\Release\Microsoft.Office.Tools.Outlook.v4.0.Utilities.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "Resources\fcm.ico"; DestDir: "{app}"; Flags: ignoreversion
Source: "{src}\DefaultConfig\*.txt"; DestDir: "{app}\DefaultConfig"; Flags:external skipifsourcedoesntexist
3 changes: 2 additions & 1 deletion ThisAddIn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ private bool DoCheck(Outlook.MailItem mail)
if (Global.EnableGPO)
{
config.Merge(Loader.LoadFromReg(RegistryPath.DefaultPolicy));
}
}
config.Merge(Loader.LoadFromDir(StandardPath.GetDefaultConfigDir()));
config.Merge(Loader.LoadFromDir(StandardPath.GetUserDir()));

MainDialog mainDialog = new MainDialog(config, mail);
Expand Down

0 comments on commit 890fa61

Please sign in to comment.