public void CheckFileEvents() { // Hides all open file items foreach (ToolStripMenuItem item in ContextOpenFile.Items) { item.Visible = false; } // Shows Add/Remove Bookmarks button text if (Bookmarks.IsBookmarked(CurrentFile.URL)) { ControlExtensions.SetControlText(ButtonBookmark, "Remove from Bookmarks"); } else { ControlExtensions.SetControlText(ButtonBookmark, "Add to Bookmarks"); } // Shows supported PDF readers installed on users machine if (BookFileTypes.Contains(FileExtension)) { NitroReaderToolStripMenuItem.Visible = File.Exists(LocalExtensions._pathNitroReader); } // Shows supported media players installed on users machine if (VideoFileTypes.Contains(FileExtension) || AudioFileTypes.Contains(FileExtension)) { WMPToolStripMenuItem.Visible = true; VLCToolStripMenuItem.Visible = File.Exists(LocalExtensions._pathVLC); MPCToolStripMenuItem.Visible = File.Exists(LocalExtensions._pathMPCCodec64) || File.Exists(LocalExtensions._pathMPC64) || File.Exists(LocalExtensions._pathMPC86); KMPlayerToolStripMenuItem.Visible = File.Exists(LocalExtensions._pathKMPlayer); PotPlayerToolStripMenuItem.Visible = File.Exists(LocalExtensions._pathPotPlayer); } // Support download manangers installed on users machine IDMToolStripMenuItem.Visible = File.Exists(LocalExtensions._pathIDM64) || File.Exists(LocalExtensions._pathIDM86); IDAToolStripMenuItem.Visible = File.Exists(LocalExtensions._pathIDA); FDMToolStripMenuItem.Visible = File.Exists(LocalExtensions._pathFDM); // Shows Open File button if context menu has items ButtonOpenWith.Visible = ContextOpenFile.Items.Count > 0; // Shows Request File Size button if size property returns 0 ButtonRequestSize.Visible = CurrentFile.Size == 0; // Displays appropriate scrolling images ScrollButtonChecks(); }
public void CheckFileEvents() { // Hides all open file items foreach (ToolStripMenuItem item in contextOpenFile.Items) { item.Visible = false; } // Shows appropriate Bookmarks button text if (!UserBookmarks.IsBookmarked(CurrentFile.URL)) { ControlExtensions.SetControlText(buttonBookmarkFile, "Add to Bookmarks"); } else { ControlExtensions.SetControlText(buttonBookmarkFile, "Remove from Bookmarks"); } // Shows supported pdf readers installed on users machine if (BookFileTypes.Contains(CurrentFile.Type)) { NitroReaderToolStripMenuItem.Visible = File.Exists(LocalExtensions.pathNitroReader); } // Shows supported pdf readers installed on users machine if (TextFileTypes.Contains(CurrentFile.Type)) { } // Shows supported media players installed on users machine if (VideoFileTypes.Contains(CurrentFile.Type) || AudioFileTypes.Contains(CurrentFile.Type)) { VLC2ToolStripMenuItem.Visible = true; WMPToolStripMenuItem.Visible = true; VLCToolStripMenuItem.Visible = File.Exists(LocalExtensions.pathVLC); MPCToolStripMenuItem.Visible = File.Exists(LocalExtensions.pathMPCCodec64) || File.Exists(LocalExtensions.pathMPC64) || File.Exists(LocalExtensions.pathMPC86); KMPlayerToolStripMenuItem.Visible = File.Exists(LocalExtensions.pathKMPlayer); PotPlayerToolStripMenuItem.Visible = File.Exists(LocalExtensions.pathPotPlayer); } // Support download manangers installed on users machine, only shown if this isn't a local file if (!IsLocalFile) { IDMToolStripMenuItem.Visible = File.Exists(LocalExtensions.pathIDM64) || File.Exists(LocalExtensions.pathIDM86) && !CurrentFile.URL.StartsWith(LocalExtensions.pathDownloadsDirectory); FDMToolStripMenuItem.Visible = File.Exists(LocalExtensions.pathFDM) && !CurrentFile.URL.StartsWith(LocalExtensions.pathDownloadsDirectory); } // Shows Open File button if context menu has items if (contextOpenFile.Items.Count > 0) { buttonOpenWith.Visible = true; } // Shows Request File Size button if size property returns 0 if (CurrentFile.Size == 0) { buttonRequestFileSize.Visible = true; } else { buttonRequestFileSize.Visible = false; } // Hides features that aren't needed for local files (Bookmark, Share & Report) if (IsLocalFile) { buttonBookmarkFile.Visible = false; panelShare.Visible = false; panelReport.Visible = false; } // Add subtitle file to be played when opening external VLC if (LocalExtensions.IsSubtitlesAvailable(CurrentFile.URL)) // If users downloads folder contains a subtitle file matching web file name { FileSubtitles = LocalExtensions.pathDownloadsDirectory + Path.GetFileNameWithoutExtension(CurrentFile.URL) + ".srt"; } else { FileSubtitles = null; } // Displays appropriate scroll images ScrollButtonChecks(); }