public static void CreateHtmlFile(string saveLocation, PsCourse course) { var head = GetHtmlHead(course); var body = GetHtmlBody(course); var path = Path.Combine(saveLocation, "index.html"); File.WriteAllText(path, head + body, Encoding.UTF8); }
private static string GetHtmlHead(PsCourse course) { return string.Format(@"<!doctype html> <html lang=""en""> <head> <meta charset=""utf-8""> <title>{0}</title> <style> {1} </style> </head>", course.Title, GetCss()); }
private static string GetHtmlHead(PsCourse course) { return(string.Format(@"<!doctype html> <html lang=""en""> <head> <meta charset=""utf-8""> <title>{0}</title> <style> {1} </style> </head>", course.Title, GetCss())); }
private static string GetHtmlBody(PsCourse course) { var body = @" <body> {0} {1} </body> "; var sb = new StringBuilder(string.Format(@" <div id=""toc""> <div id=""settings""> <input type=""radio"" name=""speed"" value=""1.00"" id=""rb100"" checked /><label for=""rb100"">1.0</label> <input type=""radio"" name=""speed"" value=""1.25"" id=""rb125"" /><label for=""rb125"">1.25</label> <input type=""radio"" name=""speed"" value=""1.50"" id=""rb150"" /><label for=""rb150"">1.5</label> <input type=""radio"" name=""speed"" value=""2.00"" id=""rb200"" /><label for=""rb200"">2.0</label> <input type=""checkbox"" id=""chkAuto"" checked /><label for=""chkAuto"">Autoplay</label> </div> <h1 id=""h1"">{0}</h1>", course.Title)); var clipCount = 0; foreach(var module in course.ModuleList) { sb.AppendLine(string.Format("<h2>{0}</h2>", module.Title)); sb.AppendLine("<ul>"); foreach(var clip in module.Clips) { sb.AppendLine(string.Format("<li data-href=\"{0}.mp4\">{1}</li>", clipCount++.ToString("000"), clip.Title)); } sb.AppendLine("</ul>"); } sb.AppendLine("</div>"); sb.AppendLine("<div id=\"vid\"><video id=\"video\" width=\"100%\" height=\"100%\" controls></video></div>"); return string.Format(body, sb.ToString(), GetJavaScript()); }
private static string GetHtmlBody(PsCourse course) { var body = @" <body> {0} {1} </body> "; var sb = new StringBuilder(string.Format(@" <div id=""toggleon"">>></div> <div id=""settings"" class=""nodisplay""> <span class=""speedsetting"" data-speed=""1.0"">1.0</span> <span class=""speedsetting"" data-speed=""1.2"">1.2</span> <span class=""speedsetting"" data-speed=""1.5"">1.5</span> <span class=""speedsetting"" data-speed=""2.0"">2.0</span> </div> <div id=""toc""> <h1 id=""h1"">{0}</h1>", course.Title)); var clipCount = 0; foreach (var module in course.ModuleList) { sb.AppendLine(string.Format("<h2>{0}</h2>", module.Title)); sb.AppendLine("<ul>"); foreach (var clip in module.Clips) { sb.AppendLine(string.Format("<li data-href=\"{0}.mp4\">{1}</li>", clipCount++.ToString("000"), clip.Title)); } sb.AppendLine("</ul>"); } sb.AppendLine("</div>"); sb.AppendLine("<div id=\"vid\"><video id=\"video\" width=\"100%\" height=\"100%\" controls></video></div>"); return(string.Format(body, sb.ToString(), GetJavaScript())); }
internal void RipSessions(PsCourse selectedCourse, string saveLocation, List <string> mimeTypes, bool clearSessions) { var count = 0; var matchingSessions = Fiddler.FiddlerApplication.UI.GetAllSessions() .Where(s => mimeTypes.Contains(s.oResponse.MIMEType)) .ToList(); foreach (var session in matchingSessions.OrderBy(s => s.id)) { var path = Path.Combine(saveLocation, count++.ToString().PadLeft(3, '0') + ".wmv"); session.SaveResponseBody(path); } HtmlFileMaker.CreateHtmlFile(saveLocation, selectedCourse); PowerShellFile.AddConversionScript(saveLocation); if (clearSessions) { Fiddler.FiddlerApplication.UI.actRemoveAllSessions(); } }