Пример #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();
        }
Пример #2
0
 private void BtnBookmarkFile_ClickButtonArea(object Sender, MouseEventArgs e)
 {
     if (UserBookmarks.IsBookmarked(currentFile.URL))
     {
         UserBookmarks.RemoveFile(currentFile.URL);
         ControlExtensions.SetControlText(buttonBookmarkFile, "Add to Bookmarks");
     }
     else
     {
         UserBookmarks.AddFile(currentFile.URL);
         ControlExtensions.SetControlText(buttonBookmarkFile, "Remove from Bookmarks");
     }
 }
Пример #3
0
 private void ButtonBookmark_Click(object sender, EventArgs e)
 {
     // Add/Remove file from users Bookmarks
     if (UserBookmarks.IsBookmarked(CurrentFile.URL))
     {
         UserBookmarks.RemoveFile(CurrentFile.URL);
         ControlExtensions.SetControlText(ButtonBookmark, "Add to Bookmarks");
     }
     else
     {
         UserBookmarks.AddFile(CurrentFile.URL);
         ControlExtensions.SetControlText(ButtonBookmark, "Remove from Bookmarks");
     }
 }
Пример #4
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();
        }
Пример #5
0
        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();
        }