Ejemplo n.º 1
0
        /// <summary>
        /// Editing PresentationExtensionList element.
        /// </summary>
        /// <param name="filePath">Tartget file path</param>
        /// <param name="log">Logger</param>
        public void EditElement(string filePath, VerifiableLog log)
        {
            using (PresentationDocument package = PresentationDocument.Open(filePath, true))
            {
                try
                {
                    PresentationExtensionList presentationExtensionList = package.PresentationPart.RootElement.Descendants <PresentationExtensionList>().Single();
                    PresentationExtension     PresentationExtension1    = package.PresentationPart.RootElement.Descendants <PresentationExtension>().Where(e => e.Uri == this.SldExtUri).Single();
                    P15.ExtendedGuideList     extendedGuideList1        = PresentationExtension1.Descendants <P15.SlideGuideList>().Single();

                    //Editing Guide(1) element
                    P15.ExtendedGuide extendedGuide1 = extendedGuideList1.Descendants <P15.ExtendedGuide>().Where(e => e.Id == this.Id1).Single();
                    extendedGuide1.Position    = this.position1;
                    extendedGuide1.Orientation = this.directionValues1;

                    A.RgbColorModelHex rgbColorModelHex1 = extendedGuide1.Descendants <A.RgbColorModelHex>().First();
                    rgbColorModelHex1.Val.Value = this.Color1;

                    //Editing Guide(2) element
                    P15.ExtendedGuide extendedGuide2 = extendedGuideList1.Descendants <P15.ExtendedGuide>().Where(e => e.Id == this.Id2).Single();
                    extendedGuide2.Position    = this.position2;
                    extendedGuide2.Orientation = this.directionValues2;

                    A.RgbColorModelHex rgbColorModelHex2 = extendedGuide2.Descendants <A.RgbColorModelHex>().First();
                    rgbColorModelHex2.Val.Value = this.Color2;

                    log.Pass("Edited the ExtendedGuideList element.");

                    PresentationExtension PresentationExtension2 = package.PresentationPart.RootElement.Descendants <PresentationExtension>().Where(e => e.Uri == this.NotesExtUri).Single();

                    P15.NotesGuideList notesGuideList = PresentationExtension2.Descendants <P15.NotesGuideList>().Single();

                    //Editing Guide(NotesGuide_1) element
                    P15.ExtendedGuide extendedGuide3 = notesGuideList.Descendants <P15.ExtendedGuide>().Where(e => e.Id == this.Id1).Single();
                    extendedGuide3.Position    = this.position3;
                    extendedGuide3.Orientation = this.directionValues2;

                    A.RgbColorModelHex rgbColorModelHex3 = extendedGuide3.Descendants <A.RgbColorModelHex>().First();
                    rgbColorModelHex3.Val.Value = this.Color3;

                    //Editing Guide(NotesGuide_2) element
                    P15.ExtendedGuide extendedGuide4 = notesGuideList.Descendants <P15.ExtendedGuide>().Where(e => e.Id == this.Id2).Single();
                    extendedGuide4.Position    = this.position4;
                    extendedGuide4.Orientation = this.directionValues1;

                    A.RgbColorModelHex rgbColorModelHex4 = extendedGuide4.Descendants <A.RgbColorModelHex>().First();
                    rgbColorModelHex4.Val.Value = this.Color4;

                    log.Pass("Edited the NotesGuideList element.");
                }
                catch (Exception e)
                {
                    log.Fail(e.Message);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Verifying PresentationExtensionList element.
        /// </summary>
        /// <param name="filePath">Tartget file path</param>
        /// <param name="log">Logger</param>
        public void VerifyElement(string filePath, VerifiableLog log)
        {
            using (PresentationDocument package = PresentationDocument.Open(filePath, false))
            {
                try
                {
                    //Verify ExtendedGuideList
                    PresentationExtensionList presentationExtensionList = package.PresentationPart.RootElement.Descendants <PresentationExtensionList>().Single();
                    PresentationExtension     PresentationExtension1    = package.PresentationPart.RootElement.Descendants <PresentationExtension>().Where(e => e.Uri == this.SldExtUri).Single();
                    P15.ExtendedGuideList     extendedGuideList1        = PresentationExtension1.Descendants <P15.SlideGuideList>().Single();

                    //Verifying Guide(1) element
                    P15.ExtendedGuide extendedGuide1 = extendedGuideList1.Descendants <P15.ExtendedGuide>().Where(e => e.Id == this.Id1).Single();

                    log.Verify(extendedGuide1.Position == this.position1, "An incorrect value, Position value of ExtendedGuide. Id=[{0}].", extendedGuide1.Id);
                    log.Verify(extendedGuide1.Orientation == this.directionValues1, "An incorrect value, Orientation value of ExtendedGuide. Id=[{0}].", extendedGuide1.Id);
                    A.RgbColorModelHex rgbColorModelHex1 = extendedGuide1.Descendants <A.RgbColorModelHex>().First();
                    log.Verify(rgbColorModelHex1.Val.Value == this.Color1, "An incorrect value, RgbColorModelHex value. Guide Id=[{0}].", extendedGuide1.Id);

                    //Verifying Guide(2) element
                    P15.ExtendedGuide extendedGuide2 = extendedGuideList1.Descendants <P15.ExtendedGuide>().Where(e => e.Id == this.Id2).Single();

                    log.Verify(extendedGuide2.Position == this.position2, "An incorrect value, Position value of ExtendedGuide. Id=[{0}].", extendedGuide1.Id);
                    log.Verify(extendedGuide2.Orientation == this.directionValues2, "An incorrect value, Orientation value of ExtendedGuide. Id=[{0}].", extendedGuide1.Id);
                    A.RgbColorModelHex rgbColorModelHex2 = extendedGuide2.Descendants <A.RgbColorModelHex>().First();
                    log.Verify(rgbColorModelHex2.Val.Value == this.Color2, "An incorrect value, RgbColorModelHex value. Guide Id=[{0}].", extendedGuide1.Id);


                    //Verify NotesGuideList
                    PresentationExtension PresentationExtension2 = package.PresentationPart.RootElement.Descendants <PresentationExtension>().Where(e => e.Uri == this.NotesExtUri).Single();
                    P15.NotesGuideList    notesGuideList         = PresentationExtension2.Descendants <P15.NotesGuideList>().Single();

                    //Verifying Guide(1) element
                    P15.ExtendedGuide extendedGuide3 = notesGuideList.Descendants <P15.ExtendedGuide>().Where(e => e.Id == this.Id1).Single();

                    log.Verify(extendedGuide3.Position == this.position3, "An incorrect value, Position value of ExtendedGuide. Id=[{0}].", extendedGuide1.Id);
                    log.Verify(extendedGuide3.Orientation == this.directionValues2, "An incorrect value, Orientation value of ExtendedGuide. Id=[{0}].", extendedGuide1.Id);
                    A.RgbColorModelHex rgbColorModelHex3 = extendedGuide3.Descendants <A.RgbColorModelHex>().First();
                    log.Verify(rgbColorModelHex3.Val.Value == this.Color3, "An incorrect value, RgbColorModelHex value. Guide Id=[{0}].", extendedGuide1.Id);

                    //Verifying Guide(2) element
                    P15.ExtendedGuide extendedGuide4 = notesGuideList.Descendants <P15.ExtendedGuide>().Where(e => e.Id == this.Id2).Single();

                    log.Verify(extendedGuide4.Position == this.position4, "An incorrect value, Position value of ExtendedGuide. Id=[{0}].", extendedGuide1.Id);
                    log.Verify(extendedGuide4.Orientation == this.directionValues1, "An incorrect value, Orientation value of ExtendedGuide. Id=[{0}].", extendedGuide1.Id);
                    A.RgbColorModelHex rgbColorModelHex4 = extendedGuide4.Descendants <A.RgbColorModelHex>().First();
                    log.Verify(rgbColorModelHex4.Val.Value == this.Color4, "An incorrect value, RgbColorModelHex value. Guide Id=[{0}].", extendedGuide1.Id);
                }
                catch (Exception e)
                {
                    log.Fail(e.Message);
                }
            }
        }