Exemple #1
0
        private void ctrlStreamInfo_Load(object sender, EventArgs e)
        {
            BackColor = Color.Transparent;

            VLCToolStripMenuItem.Visible = File.Exists(MainForm.pathVLC);
            MPCToolStripMenuItem.Visible = File.Exists(MainForm.pathMPCCodec64) || File.Exists(MainForm.pathMPC64) || File.Exists(MainForm.pathMPC86);

            if (isLocal == true)
            {
                infoAge.Text = MainForm.rm.GetString("local"); imgDownload.Visible = false; imgReportBroken.Visible = false; imgCopyURL.Visible = false;
            }

            // Checks for exact file name of a subtitle file that matches the one being loaded (e.g. Media File Name: 'Jigsaw.2017.mp4' > Subtitle File Name: 'Jigsaw.2017.srt' will be loaded)
            if (infoFileSubtitles == null)
            {
                if (UtilityTools.isExistingSubtitlesFile(infoFileURL) == true)
                {
                    infoFileSubtitles = MainForm.userDownloadsDirectory + Path.GetFileNameWithoutExtension(infoFileURL) + ".srt";
                }
            }

            if (UtilityTools.isSaved(UtilityTools.fileToJson(infoFileURL, infoName.Text, Path.GetExtension(infoName.Text).ToUpper().Replace(".", ""), infoAge.Text)))
            {
                imgAddToBookmarks.Image = Properties.Resources.bookmark_remove;
            }
            else
            {
                imgAddToBookmarks.Image = Properties.Resources.bookmark_plus;
            }
        }
Exemple #2
0
        private void ctrlFileDetails_Load(object sender, EventArgs e)
        {
            VLCToolStripMenuItem.Visible = File.Exists(MainForm.pathVLC);
            MPCToolStripMenuItem.Visible = File.Exists(MainForm.pathMPCCodec64) || File.Exists(MainForm.pathMPC64) || File.Exists(MainForm.pathMPC86);

            if (videoFileTypes.Contains(infoType.Text.ToUpper()) || audioFileTypes.Contains(infoType.Text.ToUpper()))
            {
                btnPlayMedia.Visible = true;
            }

            if (infoAge.Text == "-")
            {
                try { infoAge.Text = UtilityTools.getTimeAgo(Convert.ToDateTime(UtilityTools.getLastModifiedTime(infoFileURL.Text))); } catch { infoAge.Text = "-"; }
            }

            if (infoSize.Text == "-")
            {
                btnRequestFileSize.Visible = true;
            }

            if (infoFileSubtitles == null)
            {
                if (UtilityTools.isExistingSubtitlesFile(infoFileURL.Text) == true)
                {
                    infoFileSubtitles = MainForm.userDownloadsDirectory + Path.GetFileNameWithoutExtension(infoFileURL.Text) + ".srt";
                }
            }

            if (UtilityTools.isSaved(UtilityTools.fileToJson(infoFileURL.Text, infoName.Text, infoType.Text, infoReferrer.Text)))
            {
                btnSaveFile.Image = WebCrunch.Properties.Resources.bookmark_remove;
            }
            else
            {
                btnSaveFile.Image = WebCrunch.Properties.Resources.bookmark_plus;
            }
        }
Exemple #3
0
        private void ctrlStreamInfo_Load(object sender, EventArgs e)
        {
            BackColor = Color.Transparent;

            VLCToolStripMenuItem.Visible = File.Exists(frmOpenTheatre.pathVLC);
            MPCToolStripMenuItem.Visible = File.Exists(frmOpenTheatre.pathMPCCodec64) || File.Exists(frmOpenTheatre.pathMPC64) || File.Exists(frmOpenTheatre.pathMPC86);

            if (Properties.Settings.Default.dataBookmarks.Contains(infoFileURL))
            {
                imgAddToBookmarks.Image = Properties.Resources.bookmark_remove;
            }
            else
            {
                imgAddToBookmarks.Image = Properties.Resources.bookmark_plus;
            }

            if (isTorrent == true)
            {
                imgReportBroken.Visible = false;
                imgWatch.Visible        = false;
                imgMagnet.Visible       = true;
            }
            else if (isLocal == true)
            {
                infoFileHost.Text = frmOpenTheatre.rm.GetString("local"); imgDownload.Visible = false; imgReportBroken.Visible = false; imgShare.Visible = false; imgCopyURL.Visible = false;
            }

            // Checks for exact file name of a subtitle file that matches the one being loaded (e.g. Media File Name: 'Jigsaw.2017.mp4' > Subtitle File Name: 'Jigsaw.2017.srt' will be loaded)
            if (infoFileSubtitles == null)
            {
                if (UtilityTools.isExistingSubtitlesFile(infoFileURL) == true)
                {
                    infoFileSubtitles = frmOpenTheatre.userDownloadsDirectory + Path.GetFileNameWithoutExtension(infoFileURL) + ".srt";
                }
            }
        }
        private void ctrlStreamInfo_Load(object sender, EventArgs e)
        {
            BackColor = Color.Transparent;

            VLCToolStripMenuItem.Visible = File.Exists(frmOpenTheatre.pathVLC);
            MPCToolStripMenuItem.Visible = File.Exists(frmOpenTheatre.pathMPCCodec64) || File.Exists(frmOpenTheatre.pathMPC64) || File.Exists(frmOpenTheatre.pathMPC86);

            if (Properties.Settings.Default.dataBookmarks.Contains(infoFileURL))
            {
                imgAddToBookmarks.Image = Properties.Resources.bookmark_remove;
            }
            else
            {
                imgAddToBookmarks.Image = Properties.Resources.bookmark_plus;
            }
            if (frmOpenTheatre.currentDownloads.Contains(infoFileURL))
            {
                imgDownload.Image = Properties.Resources.cloud_sync;
            }
            else if (File.Exists(Properties.Settings.Default.downloadsDirectory + Path.GetFileName(new Uri(infoFileURL).LocalPath)) && infoFileSize.Text == UtilityTools.ToFileSize(Convert.ToDouble(new FileInfo(Properties.Settings.Default.downloadsDirectory + Path.GetFileName(new Uri(infoFileURL).LocalPath)).Length)))
            {
                imgDownload.Image = Properties.Resources.cloud_done;
            }

            if (isTorrent == true)
            {
                imgReportBroken.Visible = false;
                imgWatch.Visible        = false;
                imgMagnet.Visible       = true;
            }

            if (isLocal == false)
            {
                try
                {
                    WebRequest req = WebRequest.Create(infoFileURL);
                    req.Method  = "HEAD";
                    req.Timeout = 1500;
                    using (HttpWebResponse fileResponse = (HttpWebResponse)req.GetResponse())
                    {
                        DateTime fileModifiedTime = fileResponse.LastModified;
                        if (fileModifiedTime != null)
                        {
                            infoFileAge.Text = UtilityTools.getTimeAgo(fileModifiedTime);
                        }
                        else
                        {
                            infoFileAge.Text = "n/a";
                        }

                        int ContentLength;
                        if (int.TryParse(fileResponse.Headers.Get("Content-Length"), out ContentLength))
                        {
                            infoFileSize.Text = UtilityTools.ToFileSize(Convert.ToDouble(ContentLength));
                        }
                        else
                        {
                            infoFileSize.Text = "n/a";
                        }
                    }
                }
                catch { infoFileSize.Text = "n/a"; infoFileAge.Text = "n/a"; }
            }
            else
            {
                infoFileHost.Text = frmOpenTheatre.rm.GetString("local"); infoFileSize.Text = UtilityTools.ToFileSize(new FileInfo(infoFileURL).Length); infoFileAge.Text = UtilityTools.getTimeAgo(File.GetLastWriteTime(infoFileURL)); imgDownload.Visible = false; imgReportBroken.Visible = false; imgShare.Visible = false; imgCopyURL.Visible = false;
            }

            // Checks for exact file name of a subtitle file that matches the one being loaded (e.g. Media File Name: 'Jigsaw.2017.mp4' > Subtitle File Name: 'Jigsaw.2017.srt' will be loaded)
            if (infoFileSubtitles == null)
            {
                if (UtilityTools.isExistingSubtitlesFile(infoFileURL) == true)
                {
                    infoFileSubtitles = Properties.Settings.Default.downloadsDirectory + Path.GetFileNameWithoutExtension(infoFileURL) + ".srt";
                }
            }
        }