private void Handle(string[] args) { var parameters = ParameterUtility.GetParameters(args); var filePathParameter = parameters.FirstOrDefault(x => x.GetType() == typeof(FilePathParameter)); if (filePathParameter == null || string.IsNullOrEmpty(filePathParameter.Value) || !File.Exists(filePathParameter.Value)) { Console.WriteLine("Error: the file path parameter not found."); return; } var outputPath = parameters.First(x => x is OutputPathParameter).Value; var threadCount = int.Parse(parameters.First(x => x is ThreadParameter).Value); var speedConfiguration = GetSpeedCofiguration(parameters.First(x => x is SpeedParameter).Value); timer.Start(); var downloadService = new DownloadService( FileLinkUtility.GetFileLinks(filePathParameter.Value), outputPath, threadCount, speedConfiguration.Speed); downloadService.Download(); timer.Stop(); Console.WriteLine("Elapsed time - {0}ms", timer.ElapsedMilliseconds); }
protected void Page_Load(object sender, EventArgs e) { var type = Request["Type"]; if (!string.IsNullOrEmpty(type)) { using (var facade = new Facade()) { _CurrentPlugin = facade.LoadPlugin(type); if (_CurrentPlugin == null) { Response.Redirect("Default.aspx"); } _ParameterProperties = ParameterUtility.GetParameters(_CurrentPlugin); _ParameterProperties.ForEach(p => _ParametersList += p.ToString() + "|"); _ParametersList = _ParametersList.TrimEnd("|".ToCharArray()); } } else { Response.Redirect("Default.aspx"); } if (IsPostBack) { var cookie = Request.Cookies["mystream_subscription_add_cookie"]; if (cookie != null) { var parameters = cookie.Value.Split("|".ToCharArray()); var dictionary = new Dictionary <string, string>(); foreach (var parameter in parameters) { var paramName = parameter.Split("=".ToCharArray())[0]; var paramValue = parameter.Split("=".ToCharArray())[1]; dictionary.Add(paramName, paramValue); } using (var facade = new Facade()) { pnlSuccess.Visible = !(pnlInvalidInfo.Visible = !facade.Subscribe(_CurrentPlugin, dictionary)); } } else { // Err occured } } else { CreateControls(); } }