public void NewBaseLine() { // Set Environment A3Environment.Clean(); A3Environment.ALLOW_INFER_FROM_SLIDE = true; A3Environment.ALLOW_DEFAULT_INFER_FROM_SLIDE = true; A3Environment.ENFORCE_CHAP_SUB_SPLITTING = false; // Setup logging A3Log log = new A3Log(A3Log.Operations.NewBaseline); SavePresentationAs("new_baseline"); string chapterName = null; foreach (A3Slide s in Slides) { if (A3Environment.QUIT_FROM_CURRENT_LOOP) { return; } if (!(s.Guid is null)) { s.HGuids.Add(s.Guid); } s.Guid = Guid.NewGuid().ToString(); s.FixMetadata(log, false); if (s.Type == A3Slide.Types.CHAPTER) { A3Environment.AFTER_CHAPTER = true; chapterName = s.Chapter; continue; } if (A3Environment.AFTER_CHAPTER && s.Type is A3Slide.Types.CONTENT) { s.Chapter = chapterName; s.Subchapter = "Contents"; s.WriteTag(A3Slide.Tags.CHAPSUB); continue; } if (s.Type == A3Slide.Types.QUESTION) { break; } } Presentation.Save(); // Cleanup environemnt A3Environment.Clean(); }
public void GenerateFromYaml(string yamlPath) { // Set global variables after starting with a clean slate A3Environment.Clean(); A3Environment.ALLOW_INFER_FROM_SLIDE = true; A3Environment.ALLOW_DEFAULT_INFER_FROM_SLIDE = true; // Setup logging A3Log log = new A3Log(A3Log.Operations.GenerateFromYaml); // Ingest the yaml file A3Yaml yaml = new A3Yaml(yamlPath); // Lint the YAML file before attempting to deserialize the outline and exit early if the user cancels the operation yaml.Lint(log); if (A3Environment.QUIT_FROM_CURRENT_LOOP) { A3Environment.Clean(); return; } // Create the outline from the YAML file and exit early if the user cancels the operation A3Outline outline = yaml.Deserialize(log); if (A3Environment.QUIT_FROM_CURRENT_LOOP) { A3Environment.Clean(); return; } // Open a copy of the model PowerPoint in the current PowerPoint context A3Presentation presentation = new A3Presentation(Globals.ThisAddIn.Application.Presentations.Open(A3Environment.MODEL_POWERPOINT, 0, 0, Microsoft.Office.Core.MsoTriState.msoTrue)); // Save the presentation to a unqiue location presentation.SavePresentationAs(outline.Course); // Generate the Presentation presentation.WriteFromOutline(outline); // Cleanup the initial slides for (int i = 0; i < 6; i++) { presentation.Presentation.Slides[1].Delete(); } // Save the generated presentation and handoff control back to the user presentation.Presentation.Save(); MessageBox.Show(A3Yaml.AlertMessages[A3Yaml.Alerts.YamlGenSuccess].Replace("{}", Path), "POWERPOINT GENERATION COMPLETE!", MessageBoxButtons.OK); A3Environment.Clean(); }
public A3Outline GenerateOutline(A3Log log) { // Set Enviornment A3Environment.Clean(); // Create new blank outline A3Outline outline = new A3Outline(); // Get the course info (outline.Course, outline.Filename, outline.HasLabs, outline.HasSlides, outline.HasVideos, outline.Weburl) = GetCourseInfo(log); // Retrieve each of the chapters contents. Each chapter will recurse its own internal tree to collect all the related content ie(subchapters and their content as well. ). outline.Chapters = GetChapters(log); // Return the outline return(outline); }
public void FixMetadata(bool allowInfer, bool allowDefault) { //Set Enviornment A3Environment.Clean(); A3Environment.ALLOW_INFER_FROM_SLIDE = allowInfer; A3Environment.ALLOW_DEFAULT_INFER_FROM_SLIDE = allowDefault; // Setup logging A3Log log = new A3Log(A3Log.Operations.FixMetadata); // Fix Metadata Slides?.ForEach(s => { if (A3Environment.QUIT_FROM_CURRENT_LOOP is false) { s.FixMetadata(log, false); } }); // Cleanup A3Environment.Clean(); }
public void FillSubChapters() { // Clean the global variables A3Environment.Clean(); // Setup logging A3Log log = new A3Log(A3Log.Operations.FillSubChapters); // Initialize variables string subchapter = "Contents"; int count = 1; Slides.ForEach(s => { subchapter = s.FillSubchapter(log, s, subchapter, count); count++; }); // Clean up the global variables state A3Environment.Clean(); }
public string FillSubchapter(A3Log log, A3Slide slide, string subchapter, int count) { switch (slide.Type) { case Types.CHAPTER: log.Write(A3Log.Level.Info, "Slide number {} was identified as a Chapter slide.".Replace("{}", count.ToString())); subchapter = "Contents"; A3Environment.AFTER_CHAPTER = true; break; case Types.CONTENT: if (slide.Subchapter != subchapter && A3Environment.AFTER_CHAPTER) { if (string.Equals(slide.Subchapter, "Contents")) { slide.Subchapter = subchapter; slide.WriteTag(Tags.CHAPSUB); log.Write(A3Log.Level.Info, "Slide number {N} was identified as a Content slide which has a unique subchapter name: {SC}, which has overwritten the current \"Contents\" subchapter name.".Replace("{N}", count.ToString()).Replace("{SC}", subchapter)); } else { subchapter = slide.Subchapter; log.Write(A3Log.Level.Info, "Slide number {N} was identified as a Content slide which has a new subchapter name: {SC}.".Replace("{N}", count.ToString()).Replace("{SC}", subchapter)); } } else { log.Write(A3Log.Level.Info, "Slide number {N} was identified as a Content slide which matched the prvious subchapter: {SC}.".Replace("{N}", count.ToString()).Replace("{SC}", subchapter)); } break; case Types.QUESTION: A3Environment.Clean(); log.Write(A3Log.Level.Info, "Slide number {} was identified as a Question slide, no more slides will be parsed.".Replace("{}", count.ToString())); break; } return subchapter; }