11using SQLScriptsExplorer . Addin . Infrastructure ;
22using SQLScriptsExplorer . Addin . Models ;
3+ using SQLScriptsExplorer . Addin . Models . Enums ;
34using SQLScriptsExplorer . Addin . Repository . Interfaces ;
45using System ;
56using System . Collections . Generic ;
@@ -15,6 +16,7 @@ public class SettingsRepository : ISettingsRepository
1516 private const string ALLOWED_FILE_TYPES = "AllowedFileTypes" ;
1617 private const string SHOW_EXECUTEFILE_BUTTON = "ShowExecuteFileButton" ;
1718 private const string CONFIRM_SCRIPT_EXECUTION = "ConfirmScriptExecution" ;
19+ private const string SCRIPT_FILE_DOUBLE_CLICK_BEHAVIOUR = "ScriptFileDoubleClickBehaviour" ;
1820
1921 public List < FolderMapping > FolderMapping { get ; set ; }
2022
@@ -28,6 +30,8 @@ public class SettingsRepository : ISettingsRepository
2830
2931 public bool ConfirmScriptExecution { get ; set ; }
3032
33+ public ScriptFileDoubleClickBehaviour ScriptFileDoubleClickBehaviour { get ; set ; }
34+
3135 public SettingsRepository ( )
3236 {
3337 Refresh ( ) ;
@@ -36,7 +40,7 @@ public SettingsRepository()
3640 public void Refresh ( )
3741 {
3842 LoadFolderMapping ( ) ;
39- LoadUserInterfaceSettings ( ) ;
43+ LoadFileExplorerSettings ( ) ;
4044 LoadGenericSettings ( ) ;
4145 }
4246
@@ -50,6 +54,7 @@ public void Save()
5054 RegistryManager . SaveRegisterValue ( ALLOWED_FILE_TYPES , AllowedFileTypes ) ;
5155 RegistryManager . SaveRegisterValue ( SHOW_EXECUTEFILE_BUTTON , ShowExecuteFileButton . ToString ( ) ) ;
5256 RegistryManager . SaveRegisterValue ( CONFIRM_SCRIPT_EXECUTION , ConfirmScriptExecution . ToString ( ) ) ;
57+ RegistryManager . SaveRegisterValue ( SCRIPT_FILE_DOUBLE_CLICK_BEHAVIOUR , $ "{ ( int ) ScriptFileDoubleClickBehaviour } ") ;
5358 }
5459
5560 private void LoadFolderMapping ( )
@@ -81,7 +86,7 @@ private void LoadFolderMapping()
8186 }
8287 }
8388
84- private void LoadUserInterfaceSettings ( )
89+ private void LoadFileExplorerSettings ( )
8590 {
8691 // Show Execute File Button and
8792 var showExecuteFileButton = RegistryManager . GetRegisterValue ( SHOW_EXECUTEFILE_BUTTON ) ;
@@ -96,6 +101,13 @@ private void LoadUserInterfaceSettings()
96101 ConfirmScriptExecution = true ;
97102 else
98103 ConfirmScriptExecution = bool . Parse ( confirmScriptExecution ) ;
104+
105+ // Script File Double Click Behaviour
106+ var scriptFileDoubleClickBehaviour = RegistryManager . GetRegisterValue ( SCRIPT_FILE_DOUBLE_CLICK_BEHAVIOUR ) ;
107+ if ( string . IsNullOrEmpty ( scriptFileDoubleClickBehaviour ) )
108+ ScriptFileDoubleClickBehaviour = ScriptFileDoubleClickBehaviour . OpenNewInstance ;
109+ else
110+ ScriptFileDoubleClickBehaviour = ( ScriptFileDoubleClickBehaviour ) int . Parse ( scriptFileDoubleClickBehaviour ) ;
99111 }
100112
101113 private void LoadGenericSettings ( )
0 commit comments