public DbComparer() { InitializeComponent(); Connectors = new List<SqlConnector>(); #region Connection Bar (Source) AdBarSource = new AddressBarExt.Controls.AddressBarExt(); this.AdBarSource.BackColor = System.Drawing.Color.White; this.AdBarSource.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.AdBarSource.CurrentNode = null; this.AdBarSource.Dock = System.Windows.Forms.DockStyle.Left; this.AdBarSource.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.AdBarSource.ForeColor = System.Drawing.Color.Navy; this.AdBarSource.Location = new System.Drawing.Point(0, 0); this.AdBarSource.MinimumSize = new System.Drawing.Size(385, 26); this.AdBarSource.Name = "AddressBar"; this.AdBarSource.RootNode = null; this.AdBarSource.SelectedStyle = ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline))); this.AdBarSource.Size = new System.Drawing.Size(482, 31); this.AdBarSource.TabIndex = 2; this.AdBarSource.SelectionChange += new AddressBarExt.Controls.AddressBarExt.SelectionChanged(SourceConnectionChange); ToolStripControlHost Helper = new ToolStripControlHost(AdBarSource); Helper.Width = 350; SourceMenu.Items.Insert(1, Helper); #endregion #region Connection Bar (Destination) AdBarDestination = new AddressBarExt.Controls.AddressBarExt(); this.AdBarDestination.BackColor = System.Drawing.Color.White; this.AdBarDestination.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.AdBarDestination.CurrentNode = null; this.AdBarDestination.Dock = System.Windows.Forms.DockStyle.Left; this.AdBarDestination.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.AdBarDestination.ForeColor = System.Drawing.Color.Navy; this.AdBarDestination.Location = new System.Drawing.Point(0, 0); this.AdBarDestination.MinimumSize = new System.Drawing.Size(385, 26); this.AdBarDestination.Name = "AddressBar"; this.AdBarDestination.RootNode = null; this.AdBarDestination.SelectedStyle = ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline))); this.AdBarDestination.Size = new System.Drawing.Size(482, 31); this.AdBarDestination.TabIndex = 2; this.AdBarDestination.SelectionChange += new AddressBarExt.Controls.AddressBarExt.SelectionChanged(DestinationConnectionChange); ToolStripControlHost Helper1 = new ToolStripControlHost(AdBarDestination); Helper1.Width = 350; DestinationMenu.Items.Insert(1, Helper1); #endregion }
public MainForm() { InitializeComponent(); #region Get the configuration for the app Propiedades prop = new Propiedades(); prop.FileName = MainForm.DataStorageDir + "\\EzConfig.cfg"; if (File.Exists(prop.FileName)) { prop.LoadData(); } else { prop.AddProperty("CheckForDangerousExecutions", "1"); prop.SaveData(); } _ApplicationConfiguration = new AppConfig(); _ApplicationConfiguration.CheckForDangerousExecutions = prop.GetValue("CheckForDangerousExecutions") == "1"; #endregion StatusBar.Padding = new Padding(StatusBar.Padding.Left, StatusBar.Padding.Top, StatusBar.Padding.Left, StatusBar.Padding.Bottom); #region Connection Bar AdBar = new AddressBarExt.Controls.AddressBarExt(); this.AdBar.BackColor = System.Drawing.Color.White; this.AdBar.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.AdBar.CurrentNode = null; this.AdBar.Dock = System.Windows.Forms.DockStyle.Left; this.AdBar.Font = new System.Drawing.Font("Calibri", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.AdBar.ForeColor = System.Drawing.Color.Navy; this.AdBar.Location = new System.Drawing.Point(0, 0); this.AdBar.MinimumSize = new System.Drawing.Size(385, 26); this.AdBar.Name = "AddressBar"; this.AdBar.RootNode = null; this.AdBar.SelectedStyle = ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline))); this.AdBar.Size = new System.Drawing.Size(482, 31); this.AdBar.TabIndex = 2; this.AdBar.SelectionChange += new AddressBarExt.Controls.AddressBarExt.SelectionChanged(this.AddressBarSelectionChange); ToolStripControlHost Helper = new ToolStripControlHost(AdBar); Helper.Width = 350; MainMenu.Items.Insert(0, Helper); #endregion //not using tha app path anymore, better yet is to use a diferent folder for each winuser that uses the app, //this also makes unnecesary the manifest, and the problems it causes //DataStorageDir = Application.StartupPath; DataStorageDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Ez SQL"; if (!Directory.Exists(DataStorageDir)) { Directory.CreateDirectory(DataStorageDir); } ConDataFileName = String.Format("{0}\\ConnectionGroups.xml", DataStorageDir); if (!Directory.Exists(String.Format("{0}\\Snippets", DataStorageDir)))//create snippets dir, and create default snippets { Directory.CreateDirectory(String.Format("{0}\\Snippets", DataStorageDir)); #region Create the default snippets files using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Begin - end.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Begin___end, 0, Properties.Resources.Begin___end.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Complex Snippet.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Complex_Snippet, 0, Properties.Resources.Complex_Snippet.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Create procedure.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Create_procedure, 0, Properties.Resources.Create_procedure.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Cross join.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Cross_join, 0, Properties.Resources.Cross_join.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Cursor.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Cursor, 0, Properties.Resources.Cursor.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\declare.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.declare, 0, Properties.Resources.declare.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Inner join.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Inner_join, 0, Properties.Resources.Inner_join.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Insert into.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Insert_into, 0, Properties.Resources.Insert_into.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Insert into all.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Insert_into_all, 0, Properties.Resources.Insert_into_all.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Left outer join.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Left_outer_join, 0, Properties.Resources.Left_outer_join.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\order by.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.order_by, 0, Properties.Resources.order_by.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Outer apply.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Outer_apply, 0, Properties.Resources.Outer_apply.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Right outer join.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Right_outer_join, 0, Properties.Resources.Right_outer_join.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Select all.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Select_all, 0, Properties.Resources.Select_all.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Select some from.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Select_some_from, 0, Properties.Resources.Select_some_from.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Select top records.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Select_top_records, 0, Properties.Resources.Select_top_records.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Drop Table Helper.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Drop_Table_Helper, 0, Properties.Resources.Drop_Table_Helper.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Drop Table.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Drop_Table, 0, Properties.Resources.Drop_Table.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Is Unique.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Is_Unique, 0, Properties.Resources.Is_Unique.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Record Count.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Record_Count, 0, Properties.Resources.Record_Count.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Select Count.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Select_count, 0, Properties.Resources.Select_count.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Truncate Table.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Truncate_Table, 0, Properties.Resources.Truncate_Table.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Where.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.Where, 0, Properties.Resources.Where.Length); writer.Flush(); writer.Close(); } using (FileStream writer = new FileStream(String.Format("{0}\\Snippets\\Select.snp", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { writer.Write(Properties.Resources.select, 0, Properties.Resources.select.Length); writer.Flush(); writer.Close(); } #endregion } if (!Directory.Exists(String.Format("{0}\\QueriesLog", DataStorageDir))) { Directory.CreateDirectory(String.Format("{0}\\QueriesLog", DataStorageDir)); } if (!Directory.Exists(MainForm.DataStorageDir + "\\SintaxHighLight")) { Directory.CreateDirectory(MainForm.DataStorageDir + "\\SintaxHighLight\\"); } if (!File.Exists(String.Format("{0}\\SintaxHighLight\\SQL.xshd", DataStorageDir))) { using (FileStream Writer = new FileStream(String.Format("{0}\\SintaxHighLight\\SQL.xshd", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { Writer.Write(Properties.Resources.SQL, 0, Properties.Resources.SQL.Length); Writer.Close(); } } if (!File.Exists(String.Format("{0}\\SintaxHighLight\\CSharp.xshd", DataStorageDir))) { using (FileStream Writer = new FileStream(String.Format("{0}\\SintaxHighLight\\CSharp.xshd", DataStorageDir), System.IO.FileMode.Create, System.IO.FileAccess.Write)) { Writer.Write(Properties.Resources.CSharp, 0, Properties.Resources.CSharp.Length); Writer.Close(); } } LoadSnippets(); this.MainMenu.MouseDown += new MouseEventHandler(MainMenu_MouseDown); }