Exemplo n.º 1
0
        public void CheckFileEvents()
        {
            // Shows appropriate Bookmarks button text
            if (!UserBookmarks.IsBookmarked(currentFile.URL))
            {
                ControlExtensions.SetControlText(buttonBookmarkFile, "Add to Bookmarks");
            }
            else
            {
                ControlExtensions.SetControlText(buttonBookmarkFile, "Remove from Bookmarks");
            }

            // Shows 'Play Media' button if this file has a supported file extension
            if (videoFileTypes.Contains(currentFile.Type) || audioFileTypes.Contains(currentFile.Type))
            {
                // Support media players installed on users machine
                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);
            }

            // Support download manangers installed on users machine, shown if this isn't a local file
            IDMToolStripMenuItem.Visible = File.Exists(LocalExtensions.pathIDMAN64) || File.Exists(LocalExtensions.pathIDMAN86) && !currentFile.URL.StartsWith(LocalExtensions.userDownloadsDirectory);

            if (contextOpenFile.Items.Count != 0)
            {
                buttonOpenFile.Visible = true;
            }

            // Shows Request File Size button if size property returns 0
            if (currentFile.Size == 0)
            {
                buttonRequestFileSize.Visible = true;
            }
            else
            {
                buttonRequestFileSize.Visible = false;
            }

            // Add subtitle file to be played when opening external VLC
            if (LocalExtensions.HasExistingSubtitle(currentFile.URL) == true) // If users downloads folder contains a subtitle file matching web file name
            {
                infoFileSubtitles = LocalExtensions.userDownloadsDirectory + Path.GetFileNameWithoutExtension(currentFile.URL) + ".srt";
            }
            else
            {
                infoFileSubtitles = null;
            }

            // Displays appropriate scroll images
            ScrollButtonChecks();
        }
Exemplo n.º 2
0
        public void CheckFileEvents()
        {
            // Shows appropriate Bookmarks button text
            if (!UserBookmarks.IsBookmarked(currentFile.URL))
            {
                ControlExtensions.SetControlText(buttonBookmarkFile, "Add to Bookmarks");
            }
            else
            {
                ControlExtensions.SetControlText(buttonBookmarkFile, "Remove from Bookmarks");
            }

            // Support media players installed on users machine
            VLCToolStripMenuItem.Visible = File.Exists(LocalExtensions.pathVLC);
            MPCToolStripMenuItem.Visible = File.Exists(LocalExtensions.pathMPCCodec64) || File.Exists(LocalExtensions.pathMPC64) || File.Exists(LocalExtensions.pathMPC86);

            // Shows 'Play Media' button if is valid file extension
            if (videoFileTypes.Contains(currentFile.Type) || audioFileTypes.Contains(currentFile.Type))
            {
                buttonPlayMedia.Visible = true;
            }
            else
            {
                buttonPlayMedia.Visible = false;
            }

            // Checks if file size isn't default
            if (currentFile.Size == 0)
            {
                buttonRequestFileSize.Visible = true;
            }
            else
            {
                buttonRequestFileSize.Visible = false;
            }

            // Add subtitle file to be played when opening external VLC
            if (LocalExtensions.HasExistingSubtitle(currentFile.URL) == true) // If users downloads folder contains a subtitle file matching web file name
            {
                infoFileSubtitles = LocalExtensions.userDownloadsDirectory + Path.GetFileNameWithoutExtension(currentFile.URL) + ".srt";
            }
            else
            {
                infoFileSubtitles = null;
            }

            // Displays appropriate scroll images
            ScrollButtonChecks();
        }