static void Main(string[] args) { Environment.CurrentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var username = AppSettings.Username; var password = AppSettings.Password; var result = CommandLine.Parser.Default.ParseArguments<Options>(args); if (!result.Errors.Any()) { if (result.Value.Username.IsNotEmpty()) { username = result.Value.Username; } if (result.Value.Password.IsNotEmpty()) { password = result.Value.Password; } string downloadFolderPath = result.Value.DownloadFolderPath.IsNotEmpty() ? result.Value.DownloadFolderPath : string.Empty; string courseLink = result.Value.CourseUrl; try { var udemyDownloader = new UdemyDownloader(username, password, downloadFolderPath); udemyDownloader.Add(courseLink); udemyDownloader.ProcessDownloadJobStarted += ProcessDownloadJobStarted; udemyDownloader.ProcessDownloadJobFinished += ProcessDownloadJobFinished; udemyDownloader.ProcessFileStarted += ProcessFileStarted; Console.WriteLine("Download is started..."); udemyDownloader.Start(); } catch (MissingCredentialsException ex) { Console.WriteLine("{0}Please set the credentials in command or app.config", ex.Message); } catch (Exception ex) { Console.WriteLine("Unexpected error(s) occurred. Exception message: {0}", ex.Message); } } else { Console.WriteLine("Usage: udemydl [-u username] [-p password] -c course_link"); } }
static void Main(string[] args) { Environment.CurrentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var username = AppSettings.Username; var password = AppSettings.Password; var result = CommandLine.Parser.Default.ParseArguments <Options>(args); if (!result.Errors.Any()) { if (result.Value.Username.IsNotEmpty()) { username = result.Value.Username; } if (result.Value.Password.IsNotEmpty()) { password = result.Value.Password; } string downloadFolderPath = result.Value.DownloadFolderPath.IsNotEmpty() ? result.Value.DownloadFolderPath : string.Empty; string courseLink = result.Value.CourseUrl; try { var udemyDownloader = new UdemyDownloader(username, password, downloadFolderPath); udemyDownloader.Add(courseLink); udemyDownloader.ProcessDownloadJobStarted += ProcessDownloadJobStarted; udemyDownloader.ProcessDownloadJobFinished += ProcessDownloadJobFinished; udemyDownloader.ProcessFileStarted += ProcessFileStarted; Console.WriteLine("Download is started..."); udemyDownloader.Start(); } catch (MissingCredentialsException ex) { Console.WriteLine("{0}Please set the credentials in command or app.config", ex.Message); } catch (Exception ex) { Console.WriteLine("Unexpected error(s) occurred. Exception message: {0}", ex.Message); } } else { Console.WriteLine("Usage: udemydl [-u username] [-p password] -c course_link"); } }
public DownloadJob(UdemyDownloader client, string courseLink, string savePath) : base(courseLink, savePath, null) { _client = client; DownloadableContents = new List<DownloadableContent>(); }
public DownloadJob(UdemyDownloader client, string courseLink, string savePath) : base(courseLink, savePath, null) { _client = client; DownloadableContents = new List <DownloadableContent>(); }