private async void OnClickSaveButton(object sender, EventArgs e) { var selectedCourse = (PsCourse)ddlCourse.SelectedItem; var courseModuleIds = selectedCourse.Modules.Split(",".ToCharArray()).Select(m => int.Parse(m)); foreach(var moduleId in courseModuleIds) { selectedCourse.ModuleList.Add(PsInfo.Modules.ElementAt(moduleId)); } var options = new RipOptions { SelectedCourse = selectedCourse, SaveLocation = txtSaveLocation.Text, MimeTypes = txtVideoMimeTypes.Lines.ToList(), ClearSessions = chkClearSessions.Checked }; var ripper = new Ripper(); await ripper.Rip(options); }
public async Task Rip(RipOptions options) { if (!Directory.Exists(options.SaveLocation)) { Directory.CreateDirectory(options.SaveLocation); } var count = 0; var matchingSessions = Fiddler.FiddlerApplication.UI.GetAllSessions() .Where(s => options.MimeTypes.Contains(s.oResponse.MIMEType)) .ToList(); foreach (var session in matchingSessions.OrderBy(s => s.id)) { var path = Path.Combine(options.SaveLocation, count++.ToString().PadLeft(3, '0') + ".wmv"); await Task.Run(() => session.SaveResponseBody(path)); } HtmlFileMaker.CreateHtmlFile(options.SaveLocation, options.SelectedCourse); PowerShellFile.AddConversionScript(options.SaveLocation); if (options.ClearSessions) Fiddler.FiddlerApplication.UI.actRemoveAllSessions(); }