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); }
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); }
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); }
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); }