public override bool Initialize(IPluginHost host)
        {
            Util.Log("Plugin Initialize");

            Debug.Assert(host != null);
            if (host == null)
            {
                return(false);
            }
            pluginHost = host;

            // Custom settings
            Config = new Configuration(pluginHost.CustomConfig);

            // Require a signed version file
            UpdateCheckEx.SetFileSigKey(UpdateUrl, UpdateKey);

            // Load menus icon resource
            menuImage = Properties.Resources.Download_32;

            // Add Entry Context menu items
            entrySeparator            = new ToolStripSeparator();
            entryDownloadFaviconsItem = new ToolStripMenuItem("Download Favicons", menuImage, DownloadFaviconsEntry_Click);
            pluginHost.MainWindow.EntryContextMenu.Items.Add(entrySeparator);
            pluginHost.MainWindow.EntryContextMenu.Items.Add(entryDownloadFaviconsItem);

            // Add Group Context menu items
            groupSeparator            = new ToolStripSeparator();
            groupDownloadFaviconsItem = new ToolStripMenuItem("Download Favicons", menuImage, DownloadFaviconsGroup_Click);
            pluginHost.MainWindow.GroupContextMenu.Items.Add(groupSeparator);
            pluginHost.MainWindow.GroupContextMenu.Items.Add(groupDownloadFaviconsItem);

            //////////////////////////////////////////////////////////////////////////

            // Tools -> YAFD -> SubItems

            // Automatic prefix URLs with http://
            toolsSubItemsPrefixURLsItem         = new ToolStripMenuItem("Automatic prefix URLs with http://", null, PrefixURLsMenu_Click); // TODO: i18n?
            toolsSubItemsPrefixURLsItem.Checked = Config.GetAutomaticPrefixURLs();

            // Add Tools menu items
            toolsMenuSeparator = new ToolStripSeparator();

            toolsMenuDropDownItems = new ToolStripMenuItem[]
            {
                toolsSubItemsPrefixURLsItem,
#if DEBUG
                new ToolStripMenuItem("Reset Icons", null, ResetIconsMenu_Click)
#endif
            };
            toolsMenuYAFD = new ToolStripMenuItem("Yet Another Favicon Downloader", menuImage, toolsMenuDropDownItems);

            pluginHost.MainWindow.ToolsMenu.DropDownItems.Add(toolsMenuSeparator);
            pluginHost.MainWindow.ToolsMenu.DropDownItems.Add(toolsMenuYAFD);

            return(true);
        }
コード例 #2
0
        public override bool Initialize(IPluginHost host)
        {
            if (host == null)
            {
                return(false);
            }

            _host = host;

            //Set the version information file signature
            UpdateCheckEx.SetFileSigKey(UpdateUrl, Resources.DemoPluginExt_UpdateCheckFileSigKey);

            return(true);
        }
コード例 #3
0
        public override bool Initialize(IPluginHost host)
        {
            if (host == null)
            {
                return(false);
            }

            _host   = host;
            _config = new Configuration(_host.CustomConfig);

            //Set the version information file signature
            UpdateCheckEx.SetFileSigKey(UpdateUrl, Resources.B2SyncExt_UpdateCheckFileSigKey);

            Interface.Init(_host);
            Synchronization.Init(_config);

            _host.MainWindow.FileSaved  += OnFileSaved;
            _host.MainWindow.FileOpened += OnFileOpened;

            return(true);
        }
コード例 #4
0
        /// <summary>
        /// Only perform update check if last used database has to be opened automatically
        /// If this is not the case, use KeePass standard check for updates
        /// </summary>
        private void KeyPromptFormAdded()
        {
            if (!PluginConfig.Active)
            {
                return;
            }
            UpdateCheckType uct = UpdateCheckRequired();

            if (uct == UpdateCheckType.NotRequired)
            {
                return;
            }
            if (uct == UpdateCheckType.OnlyTranslations)
            {
                ThreadPool.QueueUserWorkItem(new WaitCallback(CheckPluginLanguages));
                return;
            }
            m_kpf = GlobalWindowManager.TopWindow as KeyPromptForm;
            UpdateCheckEx.EnsureConfigured(m_host.MainWindow);
            //Try calling the internal method UpdateCheckEx.RunPriv
            //==> Running this in a seperate threads does not force the user to wait
            //    in case of e. g. connection issues
            //==> Creating this seperate thread manually allows
            //      - to check for completion of the update check
            //      - show the update window BEFORE "Open Database" window is shown
            //      - Skip waiting in case of e. g. connection issues
            //
            //As fallback the public method UpdateCheckRunEx.Run is called
            //This method runs in a separate thread
            //==> Update window might be shown AFTER "Open Database" window is shown
            if (PluginConfig.CheckSync)
            {
                UpdateCheckBackground();
            }
            if ((m_UpdateCheckStatus == UpdateCheckStatus.NotChecked) || (m_UpdateCheckStatus == UpdateCheckStatus.Error))
            {
                UpdateCheckEx.Run(false, null);
            }
        }
        public override bool Initialize(IPluginHost host)
        {
            Util.Log("Plugin Initialize");

            Debug.Assert(host != null);
            if (host == null)
            {
                return(false);
            }
            pluginHost = host;

            // Custom settings
            Config = new Configuration(pluginHost.CustomConfig);

            // Require a signed version file
            UpdateCheckEx.SetFileSigKey(UpdateUrl, UpdateKey);

            // Load menus icon resource
            menuImage = Properties.Resources.Download_32;

            // Add Entry Context menu items
            entrySeparator            = new ToolStripSeparator();
            entryDownloadFaviconsItem = new ToolStripMenuItem("Download &Favicons", menuImage, DownloadFaviconsEntry_Click);
            pluginHost.MainWindow.EntryContextMenu.Items.Add(entrySeparator);
            pluginHost.MainWindow.EntryContextMenu.Items.Add(entryDownloadFaviconsItem);

            // Add Group Context menu items
            groupSeparator            = new ToolStripSeparator();
            groupDownloadFaviconsItem = new ToolStripMenuItem("Download Fa&vicons (recursively)", menuImage, DownloadFaviconsGroup_Click);
            pluginHost.MainWindow.GroupContextMenu.Items.Add(groupSeparator);
            pluginHost.MainWindow.GroupContextMenu.Items.Add(groupDownloadFaviconsItem);

            //////////////////////////////////////////////////////////////////////////

            // Tools -> YAFD -> SubItems

            // Automatic prefix URLs with http(s)://
            toolsSubItemsPrefixURLsItem         = new ToolStripMenuItem("Automatic prefix URLs with http(s)://", null, PrefixURLsMenu_Click); // TODO: i18n?
            toolsSubItemsPrefixURLsItem.Checked = Config.GetAutomaticPrefixURLs();

            // Use title field if URL field is empty
            toolsSubItemsTitleFieldItem         = new ToolStripMenuItem("Use title field if URL field is empty", null, TitleFieldMenu_Click); // TODO: i18n?
            toolsSubItemsTitleFieldItem.Checked = Config.GetUseTitleField();

            // Update last modified date when adding/updating icons
            toolsSubItemsUpdateModifiedItem         = new ToolStripMenuItem("Update entry last modification time", null, LastModifiedMenu_Click); // TODO: i18n?
            toolsSubItemsUpdateModifiedItem.Checked = Config.GetUpdateLastModified();

            // Tools -> YAFD -> Maximum icon size -> SubItems
            toolsMaxIconSizeSubItems = new List <ToolStripMenuItem>();

            // 16x16 ~ 128x128
            for (int i = iconSizeMin; i <= iconSizeMax; i += iconSizeIncr)
            {
                var size = string.Format("{0}x{0} px", i);
                var item = new ToolStripMenuItem(size, null, MaximumIconSize_Click);
                toolsMaxIconSizeSubItems.Add(item);
            }

            int index = (Config.GetMaximumIconSize() / iconSizeIncr) - 1;

            if (index >= 0 && index < toolsMaxIconSizeSubItems.Count)
            {
                toolsMaxIconSizeSubItems[index].Checked = true;
            }

            toolsSubItemsMaximumIconSize = new ToolStripMenuItem("Maximum icon size", (Image)pluginHost.Resources.GetObject("B16x16_Edit"), toolsMaxIconSizeSubItems.ToArray());  // TODO: i18n?

            //

            // Add Tools menu items
            toolsMenuSeparator = new ToolStripSeparator();

            toolsMenuDropDownItems = new ToolStripMenuItem[]
            {
                toolsSubItemsPrefixURLsItem,
                toolsSubItemsTitleFieldItem,
                toolsSubItemsUpdateModifiedItem,
                toolsSubItemsMaximumIconSize,
#if DEBUG
                new ToolStripMenuItem("Reset Icons", null, ResetIconsMenu_Click)
#endif
            };
            toolsMenuYAFD = new ToolStripMenuItem("Yet Another Favicon Downloader", menuImage, toolsMenuDropDownItems);

            pluginHost.MainWindow.ToolsMenu.DropDownItems.Add(toolsMenuSeparator);
            pluginHost.MainWindow.ToolsMenu.DropDownItems.Add(toolsMenuYAFD);

            return(true);
        }