From 5204bee43fab3e70356d9519f4d91c798541e635 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 29 Sep 2023 09:45:51 +0300 Subject: [PATCH] Add support for command line DB password option --- Source/Editor/ViewModel/MainViewModel.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Source/Editor/ViewModel/MainViewModel.cs b/Source/Editor/ViewModel/MainViewModel.cs index ab567d4..4922dd7 100644 --- a/Source/Editor/ViewModel/MainViewModel.cs +++ b/Source/Editor/ViewModel/MainViewModel.cs @@ -46,7 +46,7 @@ public MainViewModel() RecentFiles = new ObservableCollection(); var args = Environment.GetCommandLineArgs(); - LaunchedWithArgument = args.Length == 2; + LaunchedWithArgument = args.Length > 1; LoadSqlSyntaxHighlighter(); } @@ -738,7 +738,7 @@ public void LoadTableDataAndProperties(Table table, bool readOnly = false, bool if (resizeColumns) TableDataGrid.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); }); - //CurrentMainTabIndex = 1; + CurrentMainTabIndex = 1; TableDataCount = dataTable != null ? dataTable.Rows.Count : 0; TableDataExecutionTime = sw.Elapsed; @@ -782,11 +782,14 @@ public void LoadSqlSyntaxHighlighter() public void ProcessCommandLineArguments() { var args = Environment.GetCommandLineArgs(); - if (args.Length == 2) + if (args.Length > 1) { LaunchedWithArgument = true; dataSource = args[1]; + if (args.Length > 2) + password = args[2]; + var ext = Path.GetExtension(dataSource); if (String.Compare(ext, ".sdf", StringComparison.OrdinalIgnoreCase) == 0) AnalyzeDatabase();