private static void SaveSlides(List <Slide> slides, string presentationDir) { DataContractJsonSerializer jsonFormatter = new DataContractJsonSerializer(typeof(Slide)); for (var i = 0; i < slides.Count; i++) { SlideSaver.SaveSlideAsJpeg(slides[i], presentationDir + "/Slides/" + i.ToString() + ".jpg"); using (FileStream fs = new FileStream(presentationDir + "/SlidesJSON/" + i.ToString() + ".json", FileMode.OpenOrCreate)) { jsonFormatter.WriteObject(fs, slides[i]); } } ArchivePresentation(presentationDir); }
public RedirectResult Slide(string slideText, string slideTitle, string slideBg, string slideDir, string slideId, string slideName) { var modifiedSlide = new Slide(); modifiedSlide.Title = slideTitle; modifiedSlide.Text = slideText; modifiedSlide.PathToBackgroundPicture = slideBg; SlideSaver.SaveSlideAsJpeg(modifiedSlide, slideDir + "/Slides/" + slideId + ".jpg"); DataContractJsonSerializer jsonFormatter = new DataContractJsonSerializer(typeof(Slide)); using (FileStream fs = new FileStream(slideDir + "/SlidesJSON/" + slideId + ".json", FileMode.Create)) { jsonFormatter.WriteObject(fs, modifiedSlide); } SlideProcessor.ArchivePresentation(slideDir); return(Redirect("/Home/Slide/" + slideId + "/" + slideName)); }