Exemple #1
0
        /// <summary> Utility function that extracts the first Indy <c>Presentationrequest</c> object found
        /// in the provided list of <c>PresentationAttachment</c> objects. The Indy <c>Presentationrequest</c>
        /// is identified by <c>"@id": "libindy-request-presentation-0"</c>, as specified in the Aries RFC 0037.
        /// <see cref="https://github.com/hyperledger/aries-rfcs/tree/master/features/0037-present-proof#request-presentation"/>
        /// </summary>
        public static PresentationRequest ExtractIndyPresentationRequest(this List <PresentationAttachment> presentationAttachments)
        {
            PresentationRequest presentationRequest = null;

            presentationAttachments.ForEach(delegate(PresentationAttachment attachment)
            {
                if (attachment.Id.Equals("libindy-request-presentation-0"))
                {
                    // found first indy presentation attachment, deserialize it so that it can be returned
                    presentationRequest = attachment.Data["base64"].toPresentationRequestObject();
                }
            });

            return(presentationRequest);
        }
Exemple #2
0
        public static List <PresentationAttachment> GeneratePresentationAttachments(this PresentationRequest presentationRequest)
        {
            string base64Payload = presentationRequest.ToJson().ToBase64();
            PresentationAttachment attachment = new PresentationAttachment()
            {
                Id       = "libindy-request-presentation-0",
                MimeType = "application/json",
                Data     = new Dictionary <string, string>()
                {
                    { "base64", base64Payload }
                },
            };

            return(new List <PresentationAttachment>()
            {
                attachment
            });
        }
        public void Slides_Merge_Tests()
        {
            try
            {
                storageService.File.CopyFile(Utils.CloudStorage_Input_Folder + "/slide-sample.pptx", Utils.CloudStorage_Output_Folder + "/slide-sample.pptx");

                PresentationRequest presentationRequest = new PresentationRequest();
                Presentation        presentation        = new Presentation(Utils.CloudStorage_Input_Folder + "/slide-sample1.pptx");
                Presentation        presentation2       = new Presentation(Utils.CloudStorage_Input_Folder + "/slide-sample2.pptx");
                presentationRequest.Presentations.Add(presentation);
                presentationRequest.Presentations.Add(presentation2);

                SlidesDocumentResponse slidesDocumentResponse = slidesService.MergeDocument.MergePresentations("slide-sample.pptx", Utils.CloudStorage_Output_Folder, presentationRequest);

                storageService.File.CopyFile(Utils.CloudStorage_Input_Folder + "/slide-sample.pptx", Utils.CloudStorage_Output_Folder + "/slide-sample.pptx");

                PresentationRequest presentationRequest2 = new PresentationRequest();

                List <int> slides = new List <int>();
                slides.Add(1);
                slides.Add(2);

                Presentation presentation3 = new Presentation(Utils.CloudStorage_Input_Folder + "/slide-sample1.pptx", slides);
                Presentation presentation4 = new Presentation(Utils.CloudStorage_Input_Folder + "/slide-sample2.pptx", slides);
                presentationRequest2.Presentations.Add(presentation3);
                presentationRequest2.Presentations.Add(presentation4);

                SlidesDocumentResponse slidesDocumentResponse2 = slidesService.MergeDocument.MergePresentationsWithSlides("slide-sample.pptx", Utils.CloudStorage_Output_Folder, presentationRequest2);

                storageService.File.DownloadFile(Utils.CloudStorage_Output_Folder + "/slide-sample.pptx", Utils.Local_Output_Path + "/slide-sample.pptx");
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
        public void Slides_Merge_Tests()
        {
            try
            {
                storageService.File.CopyFile(Utils.CloudStorage_Input_Folder + "/slide-sample.pptx", Utils.CloudStorage_Output_Folder + "/slide-sample.pptx");

                PresentationRequest presentationRequest = new PresentationRequest();
                Presentation presentation = new Presentation(Utils.CloudStorage_Input_Folder + "/slide-sample1.pptx");
                Presentation presentation2 = new Presentation(Utils.CloudStorage_Input_Folder + "/slide-sample2.pptx");
                presentationRequest.Presentations.Add(presentation);
                presentationRequest.Presentations.Add(presentation2);

                SlidesDocumentResponse slidesDocumentResponse = slidesService.MergeDocument.MergePresentations("slide-sample.pptx", Utils.CloudStorage_Output_Folder, presentationRequest);

                storageService.File.CopyFile(Utils.CloudStorage_Input_Folder + "/slide-sample.pptx", Utils.CloudStorage_Output_Folder + "/slide-sample.pptx");

                PresentationRequest presentationRequest2 = new PresentationRequest();

                List<int> slides = new List<int>();
                slides.Add(1);
                slides.Add(2);

                Presentation presentation3 = new Presentation(Utils.CloudStorage_Input_Folder + "/slide-sample1.pptx", slides);
                Presentation presentation4 = new Presentation(Utils.CloudStorage_Input_Folder + "/slide-sample2.pptx", slides);
                presentationRequest2.Presentations.Add(presentation3);
                presentationRequest2.Presentations.Add(presentation4);

                SlidesDocumentResponse slidesDocumentResponse2 = slidesService.MergeDocument.MergePresentationsWithSlides("slide-sample.pptx", Utils.CloudStorage_Output_Folder, presentationRequest2);

                storageService.File.DownloadFile(Utils.CloudStorage_Output_Folder + "/slide-sample.pptx", Utils.Local_Output_Path + "/slide-sample.pptx");
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }