コード例 #1
0
        private void SaveSlides(List <Slide> slides, string presentationDir)
        {
            var jsonFormatter = new DataContractJsonSerializer(typeof(Slide));

            for (var i = 0; i < slides.Count; i++)
            {
                SlideSaver.SaveSlideAsJpeg(slides[i], presentationDir + "/Slides/" + i.ToString() + ".jpg");
                using (var fs = new FileStream(presentationDir + "/SlidesJSON/" + i.ToString() + ".json", FileMode.OpenOrCreate))
                {
                    jsonFormatter.WriteObject(fs, slides[i]);
                }
            }
            ArchivePresentation(presentationDir);
        }
コード例 #2
0
        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);
            }
            ArchivePresentation(slideDir);
            return(Redirect("/Home/Slide/" + slideId + "/" + slideName));
        }