コード例 #1
0
        private SlideModel CreateNewSlide(string id)
        {
            SlideModel slide = new SlideModel(SlideModel.rIdtoSlideIndex(id));

            this.powerpoint.addToSlideList(id, slide);
            return(slide);
        }
コード例 #2
0
 public void Scan()
 {
     try
     {
         using PresentationDocument document = PresentationDocument.Open(this.powerpoint.FilePath, true);
         SlidePart slidePart;
         var       presentation = document.PresentationPart.Presentation;
         //Console.WriteLine("Loaded");
         foreach (SlideId slideId in presentation.SlideIdList)
         {
             slidePart = document.PresentationPart.GetPartById(slideId.RelationshipId) as SlidePart;
             if (slidePart == null || slidePart.Slide == null)
             {
                 continue;
             }
             string     currentSlideRelID = slideId.RelationshipId.Value;
             SlideModel slidemodel        = CreateNewSlide(currentSlideRelID);
             Slide      slide             = slidePart.Slide;
             CheckIssues(slide, currentSlideRelID, slidePart, document);
         }
         document.Close();
     }
     catch (FileNotFoundException)
     {
         Console.WriteLine("Opps, we could not find the presentation you were referencing. Try again....");
     }
 }
コード例 #3
0
        private void CheckForVideo(Slide slide, String currentSlideRelID, SlidePart slidePart, PresentationDocument document)
        {
            var videos = slide.Descendants <VideoFromFile>();

            foreach (VideoFromFile video in videos)
            {
                String  path          = slidePart.GetReferenceRelationship(video.Link).Uri.OriginalString;
                String  fileExtension = System.IO.Path.GetExtension(path);
                String  description   = $"Found video on slide {SlideModel.rIdtoSlideIndex(currentSlideRelID)}, file extension is {fileExtension}";
                Boolean fixable;
                String  filename = System.IO.Path.GetFileName(path);
                if (fileExtension == ".mp4")
                {
                    fixable = false;
                }
                else
                {
                    fixable = true;
                }
                IIssue issue = new VideoIssueItem(filename, video, description, fixable);
                powerpoint.slides[currentSlideRelID].addToIssueList(issue);
            }
        }
コード例 #4
0
 private void CheckForAutoTransition(String currentSlideRelID, Transition transitionElement)
 {
     if (!(transitionElement.Parent.GetType() == typeof(AlternateContentFallback)))
     {
         var attribute = transitionElement.GetAttributes().Where(x => x.LocalName == "advTm").FirstOrDefault();
         if (attribute.Value != null)
         {
             IIssue issue = new AutoTransitionIssue(Int32.Parse(attribute.Value), transitionElement, $"Found auto transition on {SlideModel.rIdtoSlideIndex(currentSlideRelID)} duration: {attribute.Value} ", true);
             powerpoint.slides[currentSlideRelID].addToIssueList(issue);
         }
     }
 }
コード例 #5
0
 private void CheckForNoMouseClickTransition(string currentSlideRelID, Transition transitionElement)
 {
     if (!(transitionElement.Parent.GetType() == typeof(AlternateContentFallback)))
     {
         var attribute = transitionElement.GetAttributes().Where(x => x.LocalName == "advClick").FirstOrDefault();
         if (attribute.Value != null && attribute.Value == "0")
         {
             IIssue issue = new NoClickTransitionIssue(transitionElement, $"Found no click transition issue on {SlideModel.rIdtoSlideIndex(currentSlideRelID)}", true);
             powerpoint.slides[currentSlideRelID].addToIssueList(issue);
         }
     }
 }
コード例 #6
0
 public void addToSlideList(string Id, SlideModel slide)
 {
     slides.Add(Id, slide);
 }