Example #1
0
        private void BuildComponentsList(string strMainVersion)
        {
            string strValueColumn = KPRes.Version + "/" + KPRes.Status;

            if (Regex.IsMatch(strValueColumn, "\\s"))
            {
                strValueColumn = KPRes.Version + " / " + KPRes.Status;
            }

            m_lvComponents.Columns.Add(KPRes.Component, 100);
            m_lvComponents.Columns.Add(strValueColumn, 100);

            string strExe = WinUtil.GetExecutable();
            string strDir = UrlUtil.GetFileDirectory(strExe, true, false);

            AddComponentItem(PwDefs.ShortProductName, strMainVersion, strExe);

            string strXsl = UrlUtil.EnsureTerminatingSeparator(strDir +
                                                               AppDefs.XslFilesDir, false);
            bool b = File.Exists(strXsl + AppDefs.XslFileHtmlFull);

            b &= File.Exists(strXsl + AppDefs.XslFileHtmlLight);
            b &= File.Exists(strXsl + AppDefs.XslFileHtmlTabular);
            AddComponentItem(KPRes.XslStylesheetsKdbx, (b ? KPRes.Installed :
                                                        KPRes.NotInstalled), (b ? strXsl : null));

            b = KdbFile.IsLibraryInstalled();
            string strVer = (b ? (KdbManager.KeePassVersionString + " - 0x" +
                                  KdbManager.LibraryBuild.ToString("X4")) : KPRes.NotInstalled);
            string strPath = null;

            if (b)
            {
                string str = strDir + ((IntPtr.Size == 4) ? KdbManager.DllFile32 :
                                       KdbManager.DllFile64);
                if (File.Exists(str))
                {
                    strPath = str;
                }
                else
                {
                    Debug.Assert(false);
                }                                             // Somewhere else?
            }
            AddComponentItem(KPRes.KeePassLibCLong, strVer, strPath);
        }
Example #2
0
        public override bool TryBeginImport()
        {
            if (NativeLib.IsUnix())
            {
                MessageService.ShowWarning(KPRes.KeePassLibCNotWindows,
                                           KPRes.KeePassLibCNotWindowsHint);
                return(false);
            }

            Exception exLib;

            if (!KdbFile.IsLibraryInstalled(out exLib))
            {
                MessageService.ShowWarning(KPRes.KeePassLibCNotFound,
                                           KPRes.KdbKeePassLibC, exLib);
                return(false);
            }

            return(true);
        }
Example #3
0
        private void GetAppComponents()
        {
            ListViewItem lvi = new ListViewItem(PwDefs.ShortProductName);

            lvi.SubItems.Add(PwDefs.VersionString);
            m_lvComponents.Items.Add(lvi);

            lvi = new ListViewItem(KPRes.XslStylesheetsKdbx);
            string strPath = WinUtil.GetExecutable();

            strPath  = UrlUtil.GetFileDirectory(strPath, true, false);
            strPath += AppDefs.XslFilesDir;
            strPath  = UrlUtil.EnsureTerminatingSeparator(strPath, false);
            bool bInstalled = File.Exists(strPath + AppDefs.XslFileHtmlLite);

            bInstalled &= File.Exists(strPath + AppDefs.XslFileHtmlFull);
            bInstalled &= File.Exists(strPath + AppDefs.XslFileHtmlTabular);
            if (!bInstalled)
            {
                lvi.SubItems.Add(KPRes.NotInstalled);
            }
            else
            {
                lvi.SubItems.Add(KPRes.Installed);
            }
            m_lvComponents.Items.Add(lvi);

            lvi = new ListViewItem(KPRes.KeePassLibCLong);
            if (!KdbFile.IsLibraryInstalled())
            {
                lvi.SubItems.Add(KPRes.NotInstalled);
            }
            else
            {
                lvi.SubItems.Add(KdbManager.KeePassVersionString + " (0x" +
                                 KdbManager.LibraryBuild.ToString("X4") + ")");
            }
            m_lvComponents.Items.Add(lvi);
        }