/// <summary> /// Creates the base string lines for the storyboard file. /// </summary> /// <param name="lines"></param> public void SetLines(List <string> lines) { // Load up all the stuff IEnumerable <string> backgroundAndVideoEventsLines = FileFormatHelper.GetCategoryLines(lines, "//Background and Video events", new[] { "[", "//" }); IEnumerable <string> breakPeriodsLines = FileFormatHelper.GetCategoryLines(lines, "//Break Periods", new[] { "[", "//" }); IEnumerable <string> storyboardLayerBackgroundLines = FileFormatHelper.GetCategoryLines(lines, "//Storyboard Layer 0 (Background)", new[] { "[", "//" }); IEnumerable <string> storyboardLayerFailLines = FileFormatHelper.GetCategoryLines(lines, "//Storyboard Layer 1 (Fail)", new[] { "[", "//" }); IEnumerable <string> storyboardLayerPassLines = FileFormatHelper.GetCategoryLines(lines, "//Storyboard Layer 2 (Pass)", new[] { "[", "//" }); IEnumerable <string> storyboardLayerForegroundLines = FileFormatHelper.GetCategoryLines(lines, "//Storyboard Layer 3 (Foreground)", new[] { "[", "//" }); IEnumerable <string> storyboardLayerOverlayLines = FileFormatHelper.GetCategoryLines(lines, "//Storyboard Layer 4 (Overlay)", new[] { "[", "//" }); IEnumerable <string> storyboardSoundSamplesLines = FileFormatHelper.GetCategoryLines(lines, "//Storyboard Sound Samples", new[] { "[", "//" }); ForceAddOverlayLayer = FileFormatHelper.CategoryExists(lines, "//Storyboard Layer 4 (Overlay)"); foreach (string line in backgroundAndVideoEventsLines) { BackgroundAndVideoEvents.Add(Event.MakeEvent(line)); } foreach (string line in breakPeriodsLines) { BreakPeriods.Add(new Break(line)); } StoryboardLayerBackground.AddRange(Event.ParseEventTree(storyboardLayerBackgroundLines)); StoryboardLayerFail.AddRange(Event.ParseEventTree(storyboardLayerFailLines)); StoryboardLayerPass.AddRange(Event.ParseEventTree(storyboardLayerPassLines)); StoryboardLayerForeground.AddRange(Event.ParseEventTree(storyboardLayerForegroundLines)); StoryboardLayerOverlay.AddRange(Event.ParseEventTree(storyboardLayerOverlayLines)); foreach (string line in storyboardSoundSamplesLines) { StoryboardSoundSamples.Add(new StoryboardSoundSample(line)); } }
/// <summary> /// Appends all serialized contents of this storyboards to specified list of strings. /// </summary> /// <param name="lines"></param> public void AppendLines(List <string> lines) { lines.Add("[Events]"); lines.Add("//Background and Video events"); lines.AddRange(BackgroundAndVideoEvents.Select(e => e.GetLine())); lines.Add("//Storyboard Layer 0 (Background)"); lines.AddRange(Event.SerializeEventTree(StoryboardLayerBackground)); lines.Add("//Storyboard Layer 1 (Fail)"); lines.AddRange(Event.SerializeEventTree(StoryboardLayerFail)); lines.Add("//Storyboard Layer 2 (Pass)"); lines.AddRange(Event.SerializeEventTree(StoryboardLayerPass)); lines.Add("//Storyboard Layer 3 (Foreground)"); lines.AddRange(Event.SerializeEventTree(StoryboardLayerForeground)); if (ForceAddOverlayLayer || StoryboardLayerOverlay.Count > 0) { lines.Add("//Storyboard Layer 4 (Overlay)"); lines.AddRange(Event.SerializeEventTree(StoryboardLayerOverlay)); } lines.Add("//Storyboard Sound Samples"); lines.AddRange(StoryboardSoundSamples.Select(sbss => sbss.GetLine())); lines.Add(""); }