@@ -13,13 +13,13 @@ public class Program
1313 public string Format { get ; set ; }
1414 public string SavePath { get ; set ; }
1515 public string Quality { get ; set ; }
16- public string MkvStatus { get ; set ; }
17- public string DlStatus { get ; set ; }
16+ public string MkvStatus { get ; set ; }
17+ public string DlStatus { get ; set ; }
1818
19- /// <summary>
20- /// Downloadings a file.
21- /// </summary>
22- public void Downloading ( )
19+ /// <summary>
20+ /// Downloadings a file.
21+ /// </summary>
22+ public void Downloading ( )
2323 {
2424 var dl_status = new Program ( ) ;
2525 var process = new Process ( ) ;
@@ -28,59 +28,61 @@ public void Downloading()
2828 process . StartInfo . WindowStyle = ProcessWindowStyle . Normal ;
2929 // process.StartInfo.RedirectStandardOutput = true;
3030
31- if ( MkvStatus == "1" )
32- {
33- if ( STState == "1" )
34- {
35- if ( Quality == "best" )
36- 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 } ";
37- else
38- 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 } ";
39- }
40- else
41- {
42- if ( Quality == "best" )
43- 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 } ";
44- else
45- 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 } ";
46- }
47- }
48- else
49- {
50- if ( STState == "1" )
51- {
52- if ( Quality == "best" )
53- 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 } ";
54- else
55- 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 } ";
56- }
57- else
58- {
59- if ( Quality == "best" )
60- process . StartInfo . Arguments = $ "-f best --no-part -o \" { SavePath } \" --cookies C:\\ ProgramData\\ Crunchy-DL\\ cookies.txt { Url } ";
61- else
62- process . StartInfo . Arguments = $ "-f \" best[height={ Quality } ]\" --no-part -o \" { SavePath } \" --cookies C:\\ ProgramData\\ Crunchy-DL\\ cookies.txt { Url } ";
63- }
64- }
31+ SavePath = SavePath + @"\%(title)s.%(ext)s" ;
32+
33+ if ( MkvStatus == "1" )
34+ {
35+ if ( STState == "1" )
36+ {
37+ if ( Quality == "best" )
38+ 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 } ";
39+ else
40+ 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 } ";
41+ }
42+ else
43+ {
44+ if ( Quality == "best" )
45+ 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 } ";
46+ else
47+ 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 } ";
48+ }
49+ }
50+ else
51+ {
52+ if ( STState == "1" )
53+ {
54+ if ( Quality == "best" )
55+ 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 } ";
56+ else
57+ 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 } ";
58+ }
59+ else
60+ {
61+ if ( Quality == "best" )
62+ process . StartInfo . Arguments = $ "-f best --no-part -o \" { SavePath } \" --cookies C:\\ ProgramData\\ Crunchy-DL\\ cookies.txt { Url } ";
63+ else
64+ process . StartInfo . Arguments = $ "-f \" best[height={ Quality } ]\" --no-part -o \" { SavePath } \" --cookies C:\\ ProgramData\\ Crunchy-DL\\ cookies.txt { Url } ";
65+ }
66+ }
6567
6668
67- var viewerThread = new Thread ( ( ) =>
68- {
69- var download_window = new DownloadWindow ( ) ;
70- download_window . Show ( ) ;
71- download_window . Activate ( ) ;
72- download_window . Closed += ( s , e ) =>
73- Dispatcher . CurrentDispatcher . BeginInvokeShutdown ( DispatcherPriority . Normal ) ;
74- Dispatcher . Run ( ) ;
75- } ) ;
76- viewerThread . SetApartmentState ( ApartmentState . STA ) ; // needs to be STA or throws exception
77- viewerThread . Start ( ) ;
69+ var viewerThread = new Thread ( ( ) =>
70+ {
71+ var download_window = new DownloadWindow ( ) ;
72+ download_window . Show ( ) ;
73+ download_window . Activate ( ) ;
74+ download_window . Closed += ( s , e ) =>
75+ Dispatcher . CurrentDispatcher . BeginInvokeShutdown ( DispatcherPriority . Normal ) ;
76+ Dispatcher . Run ( ) ;
77+ } ) ;
78+ viewerThread . SetApartmentState ( ApartmentState . STA ) ; // needs to be STA or throws exception
79+ viewerThread . Start ( ) ;
7880
79- process . Start ( ) ;
80- process . WaitForExit ( ) ; // Waits here for the process to exit.
81- viewerThread . Abort ( ) ;
82- MessageBox . Show ( "Download finished !" , "Success !" , MessageBoxButton . OK , MessageBoxImage . Information ) ;
81+ process . Start ( ) ;
82+ process . WaitForExit ( ) ; // Waits here for the process to exit.
83+ viewerThread . Abort ( ) ;
84+ MessageBox . Show ( "Download finished !" , "Success !" , MessageBoxButton . OK , MessageBoxImage . Information ) ;
8385
84- }
86+ }
8587 }
8688}
0 commit comments