diff --git a/LiteDB.Studio/Forms/MainForm.cs b/LiteDB.Studio/Forms/MainForm.cs index fd16031..57b6b82 100644 --- a/LiteDB.Studio/Forms/MainForm.cs +++ b/LiteDB.Studio/Forms/MainForm.cs @@ -1,15 +1,9 @@ -using ICSharpCode.TextEditor; -using LiteDB.Engine; -using LiteDB.Studio.Forms; +using LiteDB.Studio.Forms; using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; -using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; @@ -26,8 +20,20 @@ public partial class MainForm : Form private ConnectionString _connectionString = null; private SqlCodeCompletion _codeCompletion; - public MainForm(string filename) + public MainForm(string[] args) { + string filename = null; + bool upgrade = false; + + if (args.Length >= 1) + { + filename = args[0]; + } + if (args.Length >= 2) + { + bool.TryParse(args[1], out upgrade); + } + InitializeComponent(); // For performance https://stackoverflow.com/questions/4255148/how-to-improve-painting-performance-of-datagridview @@ -43,7 +49,7 @@ public MainForm(string filename) } else { - this.Connect(new ConnectionString(filename)); + this.Connect(new ConnectionString(filename){Upgrade = upgrade }); } txtSql.ActiveTextAreaControl.TextArea.Caret.PositionChanged += (s, e) => diff --git a/LiteDB.Studio/Program.cs b/LiteDB.Studio/Program.cs index 96449fa..0121e99 100644 --- a/LiteDB.Studio/Program.cs +++ b/LiteDB.Studio/Program.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using System.Windows.Forms; using ICSharpCode.TextEditor.Util; @@ -18,7 +15,7 @@ static void Main(string[] args) Application.ApplicationExit += OnExit; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new MainForm(args.Length == 0 ? null : args[0])); + Application.Run(new MainForm(args)); } private static void OnExit(object sender, EventArgs eventArgs) @@ -27,4 +24,4 @@ private static void OnExit(object sender, EventArgs eventArgs) AppSettingsManager.PersistData(); } } -} +} \ No newline at end of file