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
        }
Exemple #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
        }
Exemple #3
0
            private void OTPDB_Synchronize(PwDatabase targetdb, FileFormatProvider fmtImp, byte[] bDecrypted, string text)
            {
                IStatusLogger dlgStatus = new OnDemandStatusDialog(true, Program.MainForm);

                dlgStatus.StartLogging(text, false);
                try
                {
                    dlgStatus.SetText(text, LogStatusType.Info);

                    PwDatabase pwImp;
                    pwImp = new PwDatabase();
                    pwImp.New(new IOConnectionInfo(), targetdb.MasterKey);
                    pwImp.MemoryProtection = targetdb.MemoryProtection.CloneDeep();
                    pwImp.MasterKey        = targetdb.MasterKey;

                    dlgStatus.SetText(text, LogStatusType.Info);

                    using (var s = new MemoryStream(bDecrypted))
                    {
                        fmtImp.Import(pwImp, s, null);
                    }
                    targetdb.KdfParameters   = pwImp.KdfParameters;
                    targetdb.DataCipherUuid  = pwImp.DataCipherUuid;
                    targetdb.HistoryMaxItems = pwImp.HistoryMaxItems;
                    targetdb.HistoryMaxSize  = pwImp.HistoryMaxSize;

                    PwMergeMethod mm = PwMergeMethod.Synchronize;

                    targetdb.RootGroup.Uuid = pwImp.RootGroup.Uuid;
                    targetdb.MergeIn(pwImp, mm, dlgStatus);
                    CleanupSyncedDB(targetdb);
                }
                catch (Exception ex)
                {
                    PluginDebug.AddError("Error loading OTP db", 0, ex.Message);
                    throw ex;
                }
                finally { dlgStatus.EndLogging(); }
            }
Exemple #4
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
        }