Пример #1
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);
            }

            SlideProcessor.ArchivePresentation(slideDir);
            return(Redirect("/Home/Slide/" + slideId + "/" + slideName));
        }
Пример #2
0
        public RedirectResult Index(IEnumerable <HttpPostedFileBase> upload)
        {
            var presentationId  = SlideProcessor.GetPresentationId();
            var presentationDir = Server.MapPath("~/Presentations/" + presentationId);

            SlideProcessor.CreatePresentationDir(presentationDir);
            var textsFile       = upload.ToArray()[0];
            var backgroundsFile = upload.ToArray()[1];

            if (backgroundsFile == null ||
                !backgroundsFile.FileName.Contains(".zip") ||
                !SlideProcessor.IsBackgroundsExtracted(presentationDir, backgroundsFile))
            {
                SlideProcessor.LoadDefaultBackground(presentationDir,
                                                     Server.MapPath("~/Files/Backgrounds/default.jpg"),
                                                     presentationDir + "/Backgrounds/default.jpg");
            }
            if (textsFile != null && textsFile.FileName.Contains(".txt") && SlideProcessor.IsSlidesCreated(presentationDir, textsFile))
            {
                return(Redirect("/Home/Slide/0/" + presentationId));
            }
            return(Redirect("/Home/Error"));
        }