Пример #1
0
        private void InstallAll()
        {
            var viewerThread = new Thread(() =>
            {
                var download_window = new DownloadWindow();
                download_window.Show();
                download_window.Activate();
                download_window.Closed += (s, e) =>
                                          Dispatcher.CurrentDispatcher.BeginInvokeShutdown(DispatcherPriority.Normal);
                Dispatcher.Run();
            });

            viewerThread.SetApartmentState(ApartmentState.STA); // needs to be STA or throws exception
            viewerThread.Start();
            var actualFolder = @"C:\ProgramData\Crunchy-DL";

            using (var client = new WebClient())
            {
                var zip = new FastZip();
                MessageBox.Show("Youtube-DL & FFmpeg not detected, downloading ...", "Important Note", MessageBoxButton.OK, MessageBoxImage.Information);
                Directory.CreateDirectory(@"C:\ProgramData\Crunchy-DL");
                client.DownloadFile("https://github.com/rg3/youtube-dl/releases/download/2018.03.20/youtube-dl.exe", @"C:\ProgramData\Crunchy-DL\youtube-dl.exe");
                client.DownloadFile("http://download.tucr.tk/ffmpeg.zip", @"C:\ProgramData\Crunchy-DL\ffmpeg.zip");
                client.DownloadFile("http://download.tucr.tk/login.zip", @"C:\ProgramData\Crunchy-DL\login.zip");

                zip.ExtractZip(actualFolder + @"\ffmpeg.zip", actualFolder, "");
                zip.ExtractZip(actualFolder + @"\login.zip", actualFolder, "");
                UpdateYTDL();
                MessageBox.Show("youtube-dl and FFmpeg are now installed.", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
                viewerThread.Abort();
                InitializeComponent();
                CheckCookie();
            }
        }
Пример #2
0
        /// <summary>
        /// Downloadings a file.
        /// </summary>
        public void Downloading()
        {
            var process = new Process();

            // Configure the process using the StartInfo properties.
            process.StartInfo.FileName    = @"C:\ProgramData\Crunchy-DL\youtube-dl.exe";
            process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

            if (STState == "1")
            {
                process.StartInfo.Arguments = $"--write-sub --sub-lang {Langue} --sub-format {Format} -f \"best[height={Quality}]\" --no-part -o \"{SavePath}\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
                var viewerThread = new Thread(() =>
                {
                    var download_window = new DownloadWindow();
                    download_window.Show();
                    download_window.Activate();
                    download_window.Closed += (s, e) =>
                                              Dispatcher.CurrentDispatcher.BeginInvokeShutdown(DispatcherPriority.Normal);
                    Dispatcher.Run();
                });
                viewerThread.SetApartmentState(ApartmentState.STA); // needs to be STA or throws exception
                viewerThread.Start();

                process.Start();
                process.WaitForExit(); // Waits here for the process to exit.
                viewerThread.Abort();
                MessageBox.Show("Download finished !", "Success !", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                process.StartInfo.Arguments = $"-f \"best[height={Quality}]\" --no-part -o \"{SavePath}\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";

                var viewerThread = new Thread(() =>
                {
                    var download_window = new DownloadWindow();
                    download_window.Show();
                    download_window.Activate();
                    download_window.Closed += (s, e) =>
                                              Dispatcher.CurrentDispatcher.BeginInvokeShutdown(DispatcherPriority.Normal);
                    Dispatcher.Run();
                });
                viewerThread.SetApartmentState(ApartmentState.STA); // needs to be STA or throws exception
                viewerThread.Start();

                process.Start();
                process.WaitForExit();// Waits here for the process to exit.
                viewerThread.Abort();
                MessageBox.Show("Download finished !", "Success !", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Пример #3
0
        private void InstallAll()
        {
            var viewerThread = new Thread(() =>
            {
                var download_window      = new DownloadWindow();
                download_window.MyString = dl_label;
                download_window.Show();
                download_window.Activate();
                download_window.Closed += (s, e) =>
                                          Dispatcher.CurrentDispatcher.BeginInvokeShutdown(DispatcherPriority.Normal);
                Dispatcher.Run();
            });

            viewerThread.SetApartmentState(ApartmentState.STA);             // needs to be STA or throws exception

            var actualFolder = @"C:\ProgramData\Crunchy-DL";

            using (var client = new WebClient())
            {
                var zip = new FastZip();
                //MessageBox.Show("Dependencies not detected, downloading ...", "Important Note", MessageBoxButton.OK, MessageBoxImage.Information);
                Directory.CreateDirectory(@"C:\ProgramData\Crunchy-DL");
                //dl_label="[1/3] Downloading dependencies : Youtube-DL ...";
                viewerThread.Start();
                client.DownloadFile("https://yt-dl.org/downloads/latest/youtube-dl.exe", @"C:\ProgramData\Crunchy-DL\youtube-dl.exe");
                //viewerThread.Abort();
                //dl_label = "[2/3] Downloading dependencies : FFmpeg ...";
                //viewerThread.Start();
                client.DownloadFile("https://raw.githubusercontent.com/skid9000/Crunchyroll-Downloader/develop/FFmpeg/ffmpeg.zip", @"C:\ProgramData\Crunchy-DL\ffmpeg.zip");
                client.DownloadFile("https://raw.githubusercontent.com/skid9000/Crunchyroll-Downloader/develop/FFmpeg/ffplay.zip", @"C:\ProgramData\Crunchy-DL\ffplay.zip");
                client.DownloadFile("https://raw.githubusercontent.com/skid9000/Crunchyroll-Downloader/develop/FFmpeg/ffprobe.zip", @"C:\ProgramData\Crunchy-DL\ffprobe.zip");
                //viewerThread.Abort();
                //dl_label = "[3/3] Downloading dependencies : Crunchyroll-Auth ...";
                //viewerThread.Start();
                client.DownloadFile("https://github.com/skid9000/CrunchyrollAuth/releases/download/1.0/login.exe", @"C:\ProgramData\Crunchy-DL\login.exe");
                //viewerThread.Abort();

                //dl_label = "Extracting ...";
                //viewerThread.Start();
                zip.ExtractZip(actualFolder + @"\ffmpeg.zip", actualFolder, "");
                zip.ExtractZip(actualFolder + @"\ffplay.zip", actualFolder, "");
                zip.ExtractZip(actualFolder + @"\ffprobe.zip", actualFolder, "");
                viewerThread.Abort();
                MessageBox.Show("youtube-dl and FFmpeg are now installed.", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
                InitializeComponent();
                CheckCookie();
            }
        }
Пример #4
0
        /// <summary>
        /// Downloadings a file.
        /// </summary>
        public void Downloading()
        {
            var dl_status = new Program();
            var process   = new Process();

            // Configure the process using the StartInfo properties.
            process.StartInfo.FileName    = @"C:\ProgramData\Crunchy-DL\youtube-dl.exe";
            process.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
            // process.StartInfo.RedirectStandardOutput = true;

            SavePath = SavePath + @"\%(title)s.%(ext)s";

            if (MkvStatus == "1")
            {
                if (STState == "1")
                {
                    if (Quality == "best")
                    {
                        process.StartInfo.Arguments = $"--write-sub --sub-lang {Langue} --sub-format {Format} -f best --no-part -o \"{SavePath}\" --recode-video mkv --embed-subs --postprocessor-args \"-disposition:s:0 default\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
                    }
                    else
                    {
                        process.StartInfo.Arguments = $"--write-sub --sub-lang {Langue} --sub-format {Format} -f \"best[height={Quality}]\" --no-part -o \"{SavePath}\" --recode-video mkv --embed-subs --postprocessor-args \"-disposition:s:0 default\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
                    }
                }
                else
                {
                    if (Quality == "best")
                    {
                        process.StartInfo.Arguments = $"-f best --no-part -o \"{SavePath}\" --recode-video mkv --embed-subs --postprocessor-args \"-disposition:s:0 default\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
                    }
                    else
                    {
                        process.StartInfo.Arguments = $"-f \"best[height={Quality}]\" --no-part -o \"{SavePath}\" --recode-video mkv --embed-subs --postprocessor-args \"-disposition:s:0 default\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
                    }
                }
            }
            else
            {
                if (STState == "1")
                {
                    if (Quality == "best")
                    {
                        process.StartInfo.Arguments = $"--write-sub --sub-lang {Langue} --sub-format {Format} -f best --no-part -o \"{SavePath}\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
                    }
                    else
                    {
                        process.StartInfo.Arguments = $"--write-sub --sub-lang {Langue} --sub-format {Format} -f \"best[height={Quality}]\" --no-part -o \"{SavePath}\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
                    }
                }
                else
                {
                    if (Quality == "best")
                    {
                        process.StartInfo.Arguments = $"-f best --no-part -o \"{SavePath}\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
                    }
                    else
                    {
                        process.StartInfo.Arguments = $"-f \"best[height={Quality}]\" --no-part -o \"{SavePath}\" --cookies C:\\ProgramData\\Crunchy-DL\\cookies.txt {Url}";
                    }
                }
            }


            var viewerThread = new Thread(() =>
            {
                var download_window = new DownloadWindow();
                download_window.Show();
                download_window.Activate();
                download_window.Closed += (s, e) =>
                                          Dispatcher.CurrentDispatcher.BeginInvokeShutdown(DispatcherPriority.Normal);
                Dispatcher.Run();
            });

            viewerThread.SetApartmentState(ApartmentState.STA);             // needs to be STA or throws exception
            viewerThread.Start();

            process.Start();
            process.WaitForExit();            // Waits here for the process to exit.
            viewerThread.Abort();
            MessageBox.Show("Download finished !", "Success !", MessageBoxButton.OK, MessageBoxImage.Information);
        }