Exemple #1
0
        public override void Init()
        {
            string auth, username = null, password = null, server, driver, param;

            this.MParameters.TryGetValue("Auth", out auth);

            if (auth != Login.defaultInput)
            {
                this.MParameters.TryGetValue("UserId", out username);
                this.MParameters.TryGetValue("Password", out password);
            }

            this.MParameters.TryGetValue("Server", out server);
            this.MParameters.TryGetValue("Driver", out driver);
            this.MParameters.TryGetValue("Param", out param);

            IQvConnector iqc = this.parent.Registered(driver);

            if (iqc == null)
            {
                throw new Exception("driver:" + driver + " not registered ...");
            }
            if (!iqc.Test(server, auth, username, password, param))
            {
                throw new Exception("driver:" + driver + " registered, but unavailable ...");
            }

            List <QvxTable> l = iqc.Init(server, auth, username, password, param, MTables, FindTable);

            this.MTables = l;
        }
        public bool Register(IQvConnector ipi)
        {
            QvxLog.Log(QvxLogFacility.Application, QvxLogSeverity.Debug, "Register()");

            if (this.ConnectorMap.ContainsKey(ipi.Name)) return false;
            ConnectorMap.Add(ipi.Name, ipi);
            return true;
        }
Exemple #3
0
        public bool Register(IQvConnector ipi)
        {
            QvxLog.Log(QvxLogFacility.Application, QvxLogSeverity.Debug, "Register()");

            if (this.ConnectorMap.ContainsKey(ipi.Name))
            {
                return(false);
            }
            ConnectorMap.Add(ipi.Name, ipi);
            return(true);
        }
Exemple #4
0
        private void getPlugins()
        {
            QvxLog.Log(QvxLogFacility.Application, QvxLogSeverity.Debug, "getPlugins()");

            string path = Application.StartupPath;

            string[] pluginFiles = new string[] {};

            try
            {
                pluginFiles = Directory.GetFiles(path, "*.DLL");
            }
            catch (Exception) { }

            IQvConnector[] ipi = new IQvConnector[pluginFiles.Length];

            for (int i = 0; i < pluginFiles.Length; i++)
            {
                string args = pluginFiles[i].Substring(pluginFiles[i].LastIndexOf("\\") + 1, pluginFiles[i].IndexOf(".DLL", StringComparison.OrdinalIgnoreCase) - pluginFiles[i].LastIndexOf("\\") - 1);

                Type ObjType = null;

                Assembly ass = Assembly.Load(args);

                if (ass != null)
                {
                    Type[] types = ass.GetTypes();
                    foreach (Type t in types)
                    {
                        if (t.GetInterface(typeof(IQvConnector).FullName) != null)
                        {
                            QvxLog.Log(QvxLogFacility.Application, QvxLogSeverity.Notice, "found plugin: " + t.ToString() + " in " + pluginFiles[i]);
                            ObjType = t;
                        }
                    }
                }

                if (ObjType != null)
                {
                    ipi[i]      = (IQvConnector)Activator.CreateInstance(ObjType);
                    ipi[i].Host = this;
                    this.Register(ipi[i]);
                }
            }
        }
        private void getPlugins()
        {
            QvxLog.Log(QvxLogFacility.Application, QvxLogSeverity.Debug, "getPlugins()");

            string path = Application.StartupPath;
            string[] pluginFiles = new string[] {};

            try
            {
                pluginFiles = Directory.GetFiles(path, "*.DLL");
            }
            catch (Exception) { }

            IQvConnector[] ipi = new IQvConnector[pluginFiles.Length];

            for (int i = 0; i < pluginFiles.Length; i++)
            {

                string args = pluginFiles[i].Substring(pluginFiles[i].LastIndexOf("\\") + 1, pluginFiles[i].IndexOf(".DLL", StringComparison.OrdinalIgnoreCase) - pluginFiles[i].LastIndexOf("\\") - 1);

                Type ObjType = null;

                Assembly ass = Assembly.Load(args);

                if (ass != null)
                {
                    Type[] types = ass.GetTypes();
                    foreach (Type t in types)
                    {
                        if (t.GetInterface(typeof(IQvConnector).FullName) != null)
                        {
                            QvxLog.Log(QvxLogFacility.Application, QvxLogSeverity.Notice, "found plugin: " + t.ToString() + " in " + pluginFiles[i]);
                            ObjType = t;
                        }
                    }
                }

                if (ObjType != null)
                {
                    ipi[i] = (IQvConnector)Activator.CreateInstance(ObjType);
                    ipi[i].Host = this;
                    this.Register(ipi[i]);
                }
            }
        }