Example #1
0
 public FrmSqlEditor(ConnectAttr attr)
 {
     InitializeComponent();
     _attr = attr;
     this.Text = String.Format("Analyseur de requêtes - {0}", attr._database);
     if (_attr._type == FrmSqlEditor.ConnectAttr.type.LOCAL)
     {
         populateRequestList();
         scSql.Panel2.ClientSizeChanged += new EventHandler(Panel2_ClientSizeChanged);
     }
 }
Example #2
0
        private void LoadConnectTypes()
        {
            string dir = Path.GetDirectoryName(Uri.UnescapeDataString(new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath));

            foreach (var filePath in Directory.GetFiles(dir, "*.dll"))
            {
                Assembly assem = null;
                try
                {
                    assem = System.Reflection.Assembly.LoadFrom(filePath);
                }
                catch
                {
                    continue;
                }

                foreach (var typ in assem.GetTypes())
                {
                    if (!typ.IsClass)
                    {
                        continue;
                    }
                    foreach (var attr in typ.GetCustomAttributes(typeof(ConnectAttr), false))
                    {
                        //System.Windows.Forms.MessageBox.Show(attr.ToString());
                        ConnectAttr cnattr = attr as ConnectAttr;
                        if (cnattr == null)
                        {
                            continue;
                        }
                        _dbTypes.Add(new DatabaseType {
                            Conn = cnattr, ConnectType = typ
                        });
                    }
                }
            }
        }