コード例 #1
0
        private void AddSlide(SlideFeedItem item, List <ChannelsSlide> channelssidesList)
        {
            string   title = item.Parameters["TitleText"].GetValue();
            string   url   = item.Parameters["ClickThroughUrl"].GetValue();
            DateTime date  = ((DateParameter)item.Parameters["PublishedDate"]).Date;
            Image    img   = ((ImageParameter)item.Parameters["MasterImage"]).GetImage();
            var      slide = new Slide(".swf");

            slide.SlideFolderID   = SlideFolder.Id;
            slide.Caption         = title.Length > 400 ? title.Substring(0, 400 - 3) + "..." : title;
            slide.ClickThroughURL = url;
            slide.Creator         = Publisher.DisplayName;
            slide.DisplayDuration = Template.DisplayDuration;
            slide.UserGivenDate   = date;
            slide.Name            = title.Length > 50 ? title.Substring(0, 50 - 3) + "..." : title;
            slide.PreviewType     = "Flash";
            slide.PlayerType      = "Flash";

            var slideFromTemplate = new SWAFile(Template.FileFullPathName);

            foreach (var parameter in item.Parameters.Values)
            {
                parameter.PassTo(slideFromTemplate);
            }

            //Aspose has a bug with getting thumbnail so use the asset content image for now
            //var image = slideFromTemplate.GetThumbnail();
            ImageUtilities.Crop(img, 100, 75, AnchorPosition.Center).Save(slide.ThumbnailFullPathName);
            slideFromTemplate.Save(slide.FileFullPathName);
            slide.Length = (int)new FileInfo(slide.FileFullPathName).Length;
            //Add slides in reverse order
            channelssidesList.Insert(0, new ChannelsSlide(Channel, slide));
        }
コード例 #2
0
        public ActionConfirmation CreateFromTemplate(int userId, int slidefolderId, IList <int> assetContentIds, int templateId, string caption, string credit)
        {
            string templatePath = (string)System.Configuration.ConfigurationSettings.AppSettings["templatePath"];

            //TODO Ensure user owns slidefolder

            var bUseTemplate = (templateId != 0);

            foreach (var assetContentId in assetContentIds)
            {
                var assetContent = this.assetContentRepository.Get(assetContentId);
                var template     = this.templateRepository.Get(templateId);
                var extension    = bUseTemplate ? ".swf" : assetContent.FilenameExtension;
                var slide        = new Slide(extension);

                slide.SlideFolderID   = slidefolderId;
                slide.Caption         = caption;
                slide.ClickThroughURL = assetContent.URL;
                slide.Creator         = credit;
                slide.UserGivenDate   = assetContent.UserGivenDate;
                slide.Name            = assetContent.Name;
                if (bUseTemplate)
                {
                    slide.DisplayDuration = template.DisplayDuration;
                    slide.PreviewType     = "Flash";
                    slide.PlayerType      = "Flash";

                    var slideFromTemplate = new SWAFile(template.FileFullPathName);
                    slideFromTemplate.UpdateBitmap("MasterImage", Image.FromFile(assetContent.FileFullPathName));
                    slideFromTemplate.UpdateText("TitleText", caption);
                    slideFromTemplate.UpdateText("ImageCreditText", credit);
                    //Aspose has a bug with getting thumbnail so use the asset content image for now
                    //var image = slideFromTemplate.GetThumbnail();
                    //ImageUtilities.Crop(image, 100, 75, AnchorPosition.Center).Save(slide.ThumbnailFullPathName);
                    File.Copy(assetContent.ThumbnailFullPathName, slide.ThumbnailFullPathName);
                    slideFromTemplate.Save(slide.FileFullPathName);
                    slide.Length = (int)new FileInfo(slide.FileFullPathName).Length;
                }
                else
                {
                    slide.DisplayDuration = assetContent.DisplayDuration;
                    slide.PreviewType     = assetContent.PreviewType;
                    if (slide.PreviewType == "Image")
                    {
                        slide.PlayerType = "Image";
                    }
                    else if (slide.PreviewType == "Flash")
                    {
                        slide.PlayerType = "Flash";
                    }
                    else if (slide.FilenameExtension == ".mov")
                    {
                        slide.PlayerType = "VideoQT";
                    }
                    else
                    {
                        slide.PlayerType = "VideoNonQT";
                    }
                    slide.Length = assetContent.Length;
                    File.Copy(assetContent.FileFullPathName, slide.FileFullPathName);
                    File.Copy(assetContent.ThumbnailFullPathName, slide.ThumbnailFullPathName);

                    //TODO: ExtractThumbnails(slideContents)
                    //ExtractThumbnails(slideContents);
                }

                slideRepository.SaveOrUpdate(slide);
            }

            return(ActionConfirmation.CreateSuccessConfirmation("Slide successfully create"));
        }
コード例 #3
0
ファイル: SlideFeedItem.cs プロジェクト: Oxigen2/Oxigen
 public virtual void PassTo(SWAFile template)
 {
     template.UpdateText(Name, GetValue());
 }
コード例 #4
0
ファイル: SlideFeedItem.cs プロジェクト: Oxigen2/Oxigen
 public override void PassTo(SWAFile template)
 {
     template.UpdateBitmap(Name, GetImage());
 }
コード例 #5
0
ファイル: SWAFileTest.cs プロジェクト: Oxigen2/Oxigen
        public void CanSeeLinkedText()
        {
            var file = new SWAFile(@"C:\Users\Ashter\Desktop\Guardian_20110420_3.swf");

            file.UpdateText("TitleTest", "Test");
        }