Exemplo n.º 1
0
        public void LoadAllPlugins(string strDir, SearchOption so, string[] vExclNames)
        {
            Debug.Assert(m_host != null);

            try
            {
                if (!Directory.Exists(strDir))
                {
                    return;                                           // No assert
                }
                List <string> lDlls = UrlUtil.GetFilePaths(strDir, "*.dll", so);
                FilterList(lDlls, vExclNames);

                List <string> lExes = UrlUtil.GetFilePaths(strDir, "*.exe", so);
                FilterList(lExes, vExclNames);

                List <string> lPlgxs = UrlUtil.GetFilePaths(strDir, "*." +
                                                            PlgxPlugin.PlgxExtension, so);
                FilterList(lPlgxs, vExclNames);

                FilterLists(lDlls, lExes, lPlgxs);

                LoadPlugins(lDlls, null, null, true);
                LoadPlugins(lExes, null, null, true);

                if (lPlgxs.Count != 0)
                {
                    OnDemandStatusDialog dlgStatus = new OnDemandStatusDialog(true, null);
                    dlgStatus.StartLogging(PwDefs.ShortProductName, false);

                    try
                    {
                        foreach (string strFile in lPlgxs)
                        {
                            PlgxPlugin.Load(strFile, dlgStatus);
                        }
                    }
                    finally { dlgStatus.EndLogging(); }
                }
            }
            catch (Exception) { Debug.Assert(false); }            // Path access violation
        }
Exemplo n.º 2
0
        public void LoadAllPlugins(string strDirectory)
        {
            Debug.Assert(m_host != null);

            try
            {
                string strPath = strDirectory;
                if (Directory.Exists(strPath) == false)
                {
                    Debug.Assert(false);
                    return;
                }

                DirectoryInfo di = new DirectoryInfo(strPath);

                FileInfo[] vFiles = UrlUtil.GetFileInfos(di, "*.dll",
                                                         SearchOption.AllDirectories).ToArray();
                LoadPlugins(vFiles, null, null, true);

                vFiles = UrlUtil.GetFileInfos(di, "*.exe",
                                              SearchOption.AllDirectories).ToArray();
                LoadPlugins(vFiles, null, null, true);

                vFiles = UrlUtil.GetFileInfos(di, "*." + PlgxPlugin.PlgxExtension,
                                              SearchOption.AllDirectories).ToArray();
                if (vFiles.Length > 0)
                {
                    OnDemandStatusDialog dlgStatus = new OnDemandStatusDialog(true, null);
                    dlgStatus.StartLogging(PwDefs.ShortProductName, false);

                    foreach (FileInfo fi in vFiles)
                    {
                        PlgxPlugin.Load(fi.FullName, dlgStatus);
                    }

                    dlgStatus.EndLogging();
                }
            }
            catch (Exception) { Debug.Assert(false); }            // Path access violation
        }
Exemplo n.º 3
0
        public void LoadAllPlugins(string strDirectory, SearchOption so,
                                   string[] vExclNames)
        {
            Debug.Assert(m_host != null);

            try
            {
                string strPath = strDirectory;
                if (!Directory.Exists(strPath))
                {
                    return;                                            // No assert
                }
                DirectoryInfo di = new DirectoryInfo(strPath);

                List <FileInfo> lFiles = UrlUtil.GetFileInfos(di, "*.dll", so);
                FilterList(lFiles, vExclNames);
                LoadPlugins(lFiles, null, null, true);

                lFiles = UrlUtil.GetFileInfos(di, "*.exe", so);
                FilterList(lFiles, vExclNames);
                LoadPlugins(lFiles, null, null, true);

                lFiles = UrlUtil.GetFileInfos(di, "*." + PlgxPlugin.PlgxExtension, so);
                FilterList(lFiles, vExclNames);
                if (lFiles.Count > 0)
                {
                    OnDemandStatusDialog dlgStatus = new OnDemandStatusDialog(true, null);
                    dlgStatus.StartLogging(PwDefs.ShortProductName, false);

                    foreach (FileInfo fi in lFiles)
                    {
                        PlgxPlugin.Load(fi.FullName, dlgStatus);
                    }

                    dlgStatus.EndLogging();
                }
            }
            catch (Exception) { Debug.Assert(false); }            // Path access violation
        }