コード例 #1
0
        private void InitializeAddWatermarkProperties(VisibleDependency visibleDependency, ref int propertyOrder)
        {
            Properties.InitializeInputFileProperties(
                PropertyNames.WatermarkFilePath,
                PropertyNames.WatermarkAuthenticationType,
                PropertyNames.WatermarkPassword,
                PropertyNames.WatermarkCertificateSource,
                PropertyNames.WatermarkCertificateFilePath,
                PropertyNames.WatermarkCertificateFilePassword,
                PropertyNames.WatermarkCertificate,
                true,
                ref propertyOrder,
                visibleDependency);

            Action <bool> applyVisibility = (isVisible) =>
            {
                Properties[PropertyNames.WatermarkPages].IsVisible    = isVisible;
                Properties[PropertyNames.WatermarkPosition].IsVisible = isVisible;
            };

            visibleDependency.VisibleChanged += (visible) => applyVisibility(visible);

            Property watermarkPages = Properties.AddOrRetrieve(PropertyNames.WatermarkPages, typeof(string), ValueUseOption.RuntimeRead, string.Empty);

            watermarkPages.Order       = propertyOrder++;
            watermarkPages.Description = "Page range to stamp with watermark. Leave this blank to add the watermark to all pages.";

            Property watermarkPosition = Properties.AddOrRetrieve(PropertyNames.WatermarkPosition, typeof(WatermarkPosition), ValueUseOption.DesignTime, WatermarkPosition.Above);

            watermarkPosition.Order       = propertyOrder++;
            watermarkPosition.Description = "Draws the watermark above or below the original document content.";

            applyVisibility(visibleDependency.Visible);
        }
コード例 #2
0
 private void InitializeInputProperties(VisibleDependency visibleDependency, ref int propertyOrder)
 {
     Properties.InitializeInputFileProperties(
         PropertyNames.InputFilePath,
         PropertyNames.InputAuthenticationType,
         PropertyNames.InputPassword,
         PropertyNames.InputCertificateSource,
         PropertyNames.InputCertificateFilePath,
         PropertyNames.InputCertificateFilePassword,
         PropertyNames.InputCertificate,
         false,
         ref propertyOrder,
         visibleDependency);
 }
コード例 #3
0
        private void InitializeInputProperties(ref int propertyOrder)
        {
            Property inputPDFFilePathProperty = Properties.AddOrRetrieve(PropertyNames.InputFilePath, typeof(string), ValueUseOption.RuntimeRead, string.Empty);

            inputPDFFilePathProperty.Order       = propertyOrder++;
            inputPDFFilePathProperty.Description = "Path to the PDF file.";
            inputPDFFilePathProperty.Editor      = typeof(FilePathEditor);
            inputPDFFilePathProperty.Validations.Add(new RequiredValidator());

            VisibleDependency certVisibleDependency = new VisibleDependency(() => Properties.PropertyValueEquals(PropertyNames.InputAuthenticationType,
                                                                                                                 AuthenticationType.Certificate));

            void applyVisibility()
            {
                AuthenticationType authenticationTypeValue = Properties[PropertyNames.InputAuthenticationType].GetValue <AuthenticationType>();

                Properties[PropertyNames.InputPassword].IsVisible = authenticationTypeValue == AuthenticationType.Password;
            }

            void updateVisibility(object sender, EventArgs args)
            {
                applyVisibility();
                certVisibleDependency.Refresh();
            }

            Property authenticationTypeProperty = Properties.AddOrRetrieve(PropertyNames.InputAuthenticationType, typeof(AuthenticationType),
                                                                           ValueUseOption.DesignTime, AuthenticationType.None);

            authenticationTypeProperty.Order       = propertyOrder++;
            authenticationTypeProperty.Description = "Authentication type required to open the PDF file.";
            authenticationTypeProperty.Validations.Add(new CertificateAuthenticationValidator());
            authenticationTypeProperty.ValueChanged += updateVisibility;

            Property pdfPassword = Properties.AddOrRetrieve(PropertyNames.InputPassword, typeof(string), ValueUseOption.RuntimeRead, string.Empty);

            pdfPassword.Order       = propertyOrder++;
            pdfPassword.Description = "Password required to access the PDF file.";
            pdfPassword.Validations.Add(new RequiredValidator());

            Properties.InitializeCertificateProperties(
                PropertyNames.InputCertificateSource,
                PropertyNames.InputCertificateFilePath,
                PropertyNames.InputCertificateFilePassword,
                PropertyNames.InputCertificate,
                ref propertyOrder,
                certVisibleDependency);

            applyVisibility();
        }
        public static void InitializeCertificateProperties(
            this PropertyCollection properties,
            string certificateSourcePropertyName,
            string certificateFilePathPropertyName,
            string certificateFilePasswordPropertyName,
            string certificatePropertyName,
            ref int propertyOrder,
            VisibleDependency visibleDependency)
        {
            Action <bool> applyVisibility = (isVisible) =>
            {
                CertificateSource certificateSourceValue = properties[certificateSourcePropertyName].GetValue <CertificateSource>();

                properties[certificateSourcePropertyName].IsVisible       = isVisible;
                properties[certificateFilePathPropertyName].IsVisible     = (isVisible && certificateSourceValue == CertificateSource.File);
                properties[certificateFilePasswordPropertyName].IsVisible = (isVisible && certificateSourceValue == CertificateSource.File);
                properties[certificatePropertyName].IsVisible             = (isVisible && certificateSourceValue == CertificateSource.Store);
            };
            EventHandler updateVisibility = (sender, args) => applyVisibility(visibleDependency.Visible);

            visibleDependency.VisibleChanged += (visible) => applyVisibility(visible);

            Property certificateSource = properties.AddOrRetrieve(certificateSourcePropertyName, typeof(CertificateSource), ValueUseOption.DesignTime, CertificateSource.File);

            certificateSource.Order         = propertyOrder++;
            certificateSource.Description   = "Source to load the certificate from.";
            certificateSource.ValueChanged += updateVisibility;

            Property certificateFilePath = properties.AddOrRetrieve(certificateFilePathPropertyName, typeof(string), ValueUseOption.RuntimeRead, string.Empty);

            certificateFilePath.Order       = propertyOrder++;
            certificateFilePath.Description = "Path to the file containing a certificate.";
            certificateFilePath.Editor      = typeof(FilePathEditor);
            certificateFilePath.Validations.Add(new RequiredValidator());

            Property certificateFilePassword = properties.AddOrRetrieve(certificateFilePasswordPropertyName, typeof(string), ValueUseOption.RuntimeRead, string.Empty);

            certificateFilePassword.Order       = propertyOrder++;
            certificateFilePassword.Description = "Password required to open the certificate file.";

            Property certificate = properties.AddOrRetrieve(certificatePropertyName, typeof(StoredCertificate), ValueUseOption.DesignTime, new StoredCertificate());

            certificate.Order       = propertyOrder++;
            certificate.Description = "Certificate in the windows keystore.";
            certificate.Validations.Add(new StoredCertificateValidator());
            certificate.Editor = typeof(CertificateEditor);

            applyVisibility(visibleDependency.Visible);
        }
コード例 #5
0
        private void InitializeFillFormProperties(VisibleDependency visibleDependency, ref int propertyOrder)
        {
            Action <bool> applyVisibility = (isVisible) =>
            {
                Properties[PropertyNames.FillFormFormData].IsVisible = isVisible;
            };

            visibleDependency.VisibleChanged += (visible) => applyVisibility(visible);

            Property formData = Properties.AddOrRetrieve(PropertyNames.FillFormFormData, typeof(object), ValueUseOption.RuntimeRead, null);

            formData.Order       = propertyOrder++;
            formData.Description = "A custom object that contains the form data to insert.";
            formData.Validations.Add(new RequiredValidator());

            applyVisibility(visibleDependency.Visible);
        }
コード例 #6
0
        private void InitializeSplitProperties(VisibleDependency visibleDependency, ref int propertyOrder)
        {
            Action <bool> applyVisibility = (isVisible) =>
            {
                Properties[PropertyNames.SplitLoopResults].IsVisible = isVisible;
            };

            visibleDependency.VisibleChanged += (visible) => applyVisibility(visible);

            Property loopResults = Properties.AddOrRetrieve(PropertyNames.SplitLoopResults, typeof(bool), ValueUseOption.DesignTime, false);

            loopResults.Order         = propertyOrder++;
            loopResults.Description   = "Loop through the generated file names.";
            loopResults.ValueChanged += RefreshOutput;

            applyVisibility(visibleDependency.Visible);
        }
コード例 #7
0
        private void InitializeConcatenateProperties(VisibleDependency visibleDependency, ref int propertyOrder)
        {
            Action <bool> applyVisibility = (isVisible) =>
            {
                Properties[PropertyNames.InputFiles].IsVisible = isVisible;
            };

            visibleDependency.VisibleChanged += (visible) => applyVisibility(visible);

            Property inputFiles = Properties.AddOrRetrieve(PropertyNames.InputFiles, TypeReference.CreateList(typeof(string)), ValueUseOption.RuntimeRead, null);

            inputFiles.Order       = propertyOrder++;
            inputFiles.Description = "List of PDF files to concatenate.";
            inputFiles.Validations.Add(new RequiredValidator());

            applyVisibility(visibleDependency.Visible);
        }
コード例 #8
0
        private void InitializeProperties()
        {
            int propertyOrder = 1;

            var fillFormDependency       = new VisibleDependency(() => Properties.PropertyValueEquals(PropertyNames.Operation, Operation.FillForm));
            var protectDependency        = new VisibleDependency(() => Properties.PropertyValueEquals(PropertyNames.Operation, Operation.Protect));
            var splitDependency          = new VisibleDependency(() => Properties.PropertyValueEquals(PropertyNames.Operation, Operation.Split));
            var concatenateDependency    = new VisibleDependency(() => Properties.PropertyValueEquals(PropertyNames.Operation, Operation.Concatenate));
            var notConcatenateDependency = new VisibleDependency(() => !Properties.PropertyValueEquals(PropertyNames.Operation, Operation.Concatenate));
            var addWatermarkDependency   = new VisibleDependency(() => Properties.PropertyValueEquals(PropertyNames.Operation, Operation.AddWatermark));
            var signDependency           = new VisibleDependency(() => Properties.PropertyValueEquals(PropertyNames.Operation, Operation.Sign));

            Property operation = Properties.AddOrRetrieve(PropertyNames.Operation, typeof(Operation), ValueUseOption.DesignTime, Operation.FillForm);

            operation.Order         = propertyOrder++;
            operation.Description   = "The operation to perform on the document.";
            operation.ValueChanged += RefreshOutput;
            operation.ValueChanged += (sender, args) =>
            {
                fillFormDependency.Refresh();
                protectDependency.Refresh();
                splitDependency.Refresh();
                concatenateDependency.Refresh();
                notConcatenateDependency.Refresh();
                addWatermarkDependency.Refresh();
                signDependency.Refresh();
            };

            InitializeInputProperties(notConcatenateDependency, ref propertyOrder);
            InitializeConcatenateProperties(concatenateDependency, ref propertyOrder);
            InitializeSplitProperties(splitDependency, ref propertyOrder);
            InitializeAddWatermarkProperties(addWatermarkDependency, ref propertyOrder);
            InitializeSignProperties(signDependency, ref propertyOrder);

            Property outputFilePath = Properties.AddOrRetrieve(PropertyNames.OutputFilePath, typeof(string), ValueUseOption.RuntimeRead, string.Empty);

            outputFilePath.Order       = propertyOrder++;
            outputFilePath.Description = "Path of the PDF file to write to.";
            outputFilePath.Editor      = typeof(FilePathEditor);
            outputFilePath.Validations.Add(new RequiredValidator());

            InitializeFillFormProperties(fillFormDependency, ref propertyOrder);
            InitializeProtectProperties(protectDependency, ref propertyOrder);
        }
コード例 #9
0
        private void InitializeProtectProperties(VisibleDependency visibleDependency, ref int propertyOrder)
        {
            var protectCertDependency = new VisibleDependency(() => visibleDependency.Visible && Properties.PropertyValueEquals(PropertyNames.ProtectProtection, AuthenticationType.Certificate));

            Action <bool> applyVisibility = (isVisible) =>
            {
                AuthenticationType protectionValue = Properties[PropertyNames.ProtectProtection].GetValue <AuthenticationType>();
                bool addDocumentRestrictionsValue  = Properties[PropertyNames.ProtectAddDocumentRestrictions].GetValue <bool>();

                Properties[PropertyNames.ProtectProtection].IsVisible              = isVisible;
                Properties[PropertyNames.ProtectDocumentOpenPassword].IsVisible    = (isVisible && protectionValue == AuthenticationType.Password);
                Properties[PropertyNames.ProtectAddDocumentRestrictions].IsVisible = (isVisible && (protectionValue == AuthenticationType.Certificate || protectionValue == AuthenticationType.Password));
                Properties[PropertyNames.ProtectAllowPrinting].IsVisible           = (isVisible && addDocumentRestrictionsValue);
                Properties[PropertyNames.ProtectAllowChanges].IsVisible            = (isVisible && addDocumentRestrictionsValue);
                Properties[PropertyNames.ProtectAllowCopying].IsVisible            = (isVisible && addDocumentRestrictionsValue);
                Properties[PropertyNames.ProtectAllowScreenReaders].IsVisible      = (isVisible && addDocumentRestrictionsValue);
                Properties[PropertyNames.ProtectPermissionsPassword].IsVisible     = (isVisible && addDocumentRestrictionsValue && protectionValue == AuthenticationType.Password);
                Properties[PropertyNames.ProtectEncryption].IsVisible              = (isVisible && (protectionValue == AuthenticationType.Certificate || protectionValue == AuthenticationType.Password));
                Properties[PropertyNames.ProtectDontEncryptMetadata].IsVisible     = (isVisible && (protectionValue == AuthenticationType.Certificate || protectionValue == AuthenticationType.Password));
            };
            EventHandler updateVisibility = (sender, args) =>
            {
                applyVisibility(visibleDependency.Visible);
                protectCertDependency.Refresh();
            };

            visibleDependency.VisibleChanged += (visible) =>
            {
                applyVisibility(visible);
                protectCertDependency.Refresh();
            };

            Property protection = Properties.AddOrRetrieve(PropertyNames.ProtectProtection, typeof(AuthenticationType), ValueUseOption.DesignTime, AuthenticationType.None);

            protection.Order         = propertyOrder++;
            protection.Description   = "Method used to protect the PDF.";
            protection.ValueChanged += updateVisibility;

            Property documentOpenPassword = Properties.AddOrRetrieve(PropertyNames.ProtectDocumentOpenPassword, typeof(string), ValueUseOption.RuntimeRead, string.Empty);

            documentOpenPassword.Order       = propertyOrder++;
            documentOpenPassword.Description = "Password required to open the PDF document.";

            Properties.InitializeCertificateProperties(
                PropertyNames.ProtectCertificateSource,
                PropertyNames.ProtectCertificateFilePath,
                PropertyNames.ProtectCertificateFilePassword,
                PropertyNames.ProtectCertificate,
                ref propertyOrder,
                protectCertDependency);

            Property addDocumentRestrictions = Properties.AddOrRetrieve(PropertyNames.ProtectAddDocumentRestrictions, typeof(bool), ValueUseOption.DesignTime, false);

            addDocumentRestrictions.Order         = propertyOrder++;
            addDocumentRestrictions.Description   = "Specify restrictions on the PDF document.";
            addDocumentRestrictions.ValueChanged += updateVisibility;

            Property allowPrinting = Properties.AddOrRetrieve(PropertyNames.ProtectAllowPrinting, typeof(Printing), ValueUseOption.DesignTime, Printing.None);

            allowPrinting.Order       = propertyOrder++;
            allowPrinting.Description = "The level of printing allowed on the PDF document.";

            Property allowChanges = Properties.AddOrRetrieve(PropertyNames.ProtectAllowChanges, typeof(Changes), ValueUseOption.DesignTime, Changes.None);

            allowChanges.Order       = propertyOrder++;
            allowChanges.Description = "The editing actions allowed on the PDF document.";

            Property allowCopying = Properties.AddOrRetrieve(PropertyNames.ProtectAllowCopying, typeof(bool), ValueUseOption.DesignTime, false);

            allowCopying.Order         = propertyOrder++;
            allowCopying.Description   = "Enable copying of text, images and other content.";
            allowCopying.ValueChanged += (sender, args) =>
            {
                bool currentValue = Properties[PropertyNames.ProtectAllowCopying].GetValue <bool>();
                if (currentValue)
                {
                    Properties[PropertyNames.ProtectAllowScreenReaders].Value = true;
                }
            };

            Property allowScreenReaders = Properties.AddOrRetrieve(PropertyNames.ProtectAllowScreenReaders, typeof(bool), ValueUseOption.DesignTime, false);

            allowScreenReaders.Order       = propertyOrder++;
            allowScreenReaders.Description = "Enable text access for screen reader devices for the visually impaired.";

            Property permissionsPassword = Properties.AddOrRetrieve(PropertyNames.ProtectPermissionsPassword, typeof(string), ValueUseOption.RuntimeRead, string.Empty);

            permissionsPassword.Order       = propertyOrder++;
            permissionsPassword.Description = "Password to override restrictions placed on the PDF document.";
            permissionsPassword.Validations.Add(new RequiredValidator());

            Property encryption = Properties.AddOrRetrieve(PropertyNames.ProtectEncryption, typeof(Encryption), ValueUseOption.DesignTime, Encryption.AES128);

            encryption.Order       = propertyOrder++;
            encryption.Description = "Encryption method used to proptect the PDF.";

            Property dontEncryptMetadata = Properties.AddOrRetrieve(PropertyNames.ProtectDontEncryptMetadata, typeof(bool), ValueUseOption.DesignTime, false);

            dontEncryptMetadata.Order       = propertyOrder++;
            dontEncryptMetadata.Description = "Don't encrypt the document metadata.";

            applyVisibility(visibleDependency.Visible);
        }
コード例 #10
0
        private void InitializeSignProperties(VisibleDependency visibleDependency, ref int propertyOrder)
        {
            Action <bool> applyVisibility = (isVisible) =>
            {
                SignaturePosition signPlacementValue = Properties[PropertyNames.SignPlacement].GetValue <SignaturePosition>();

                Properties[PropertyNames.SignSignedAt].IsVisible         = isVisible;
                Properties[PropertyNames.SignReason].IsVisible           = isVisible;
                Properties[PropertyNames.SignLockAfterSigning].IsVisible = isVisible;
                Properties[PropertyNames.SignPlacement].IsVisible        = isVisible;
                Properties[PropertyNames.SignFieldName].IsVisible        = (isVisible && signPlacementValue == SignaturePosition.FormField);
                Properties[PropertyNames.SignPositionX].IsVisible        = (isVisible && signPlacementValue == SignaturePosition.OnPage);
                Properties[PropertyNames.SignPositionY].IsVisible        = (isVisible && signPlacementValue == SignaturePosition.OnPage);
                Properties[PropertyNames.SignWidth].IsVisible            = (isVisible && signPlacementValue == SignaturePosition.OnPage);
                Properties[PropertyNames.SignHeight].IsVisible           = (isVisible && signPlacementValue == SignaturePosition.OnPage);
                Properties[PropertyNames.SignBackgroundImage].IsVisible  = (isVisible && (signPlacementValue == SignaturePosition.FormField || signPlacementValue == SignaturePosition.OnPage));
                Properties[PropertyNames.SignPage].IsVisible             = (isVisible && signPlacementValue == SignaturePosition.OnPage);
            };
            EventHandler updateVisibility = (sender, args) => applyVisibility(visibleDependency.Visible);

            visibleDependency.VisibleChanged += (visible) => applyVisibility(visible);

            Property signedAt = Properties.AddOrRetrieve(PropertyNames.SignSignedAt, typeof(string), ValueUseOption.RuntimeRead, string.Empty);

            signedAt.Order       = propertyOrder++;
            signedAt.Description = "Location where the signing took place.";
            signedAt.Validations.Add(new RequiredValidator());

            Property reason = Properties.AddOrRetrieve(PropertyNames.SignReason, typeof(string), ValueUseOption.RuntimeRead, string.Empty);

            reason.Order       = propertyOrder++;
            reason.Description = "Reason for signing the document.";
            reason.Validations.Add(new RequiredValidator());

            Property lockAfterSigning = Properties.AddOrRetrieve(PropertyNames.SignLockAfterSigning, typeof(bool), ValueUseOption.DesignTime, false);

            lockAfterSigning.Order       = propertyOrder++;
            lockAfterSigning.Description = "Lock the document to prevent further changes.";

            Properties.InitializeCertificateProperties(
                PropertyNames.SignCertificateSource,
                PropertyNames.SignCertificateFilePath,
                PropertyNames.SignCertificateFilePassword,
                PropertyNames.SignCertificate,
                ref propertyOrder,
                visibleDependency);

            Property placement = Properties.AddOrRetrieve(PropertyNames.SignPlacement, typeof(SignaturePosition), ValueUseOption.DesignTime, SignaturePosition.Hidden);

            placement.Order         = propertyOrder++;
            placement.Description   = "Where to put the signature in the document.";
            placement.ValueChanged += updateVisibility;

            Property fieldName = Properties.AddOrRetrieve(PropertyNames.SignFieldName, typeof(string), ValueUseOption.RuntimeRead, string.Empty);

            fieldName.Order       = propertyOrder++;
            fieldName.Description = "Form field name to place the signature in.";
            fieldName.Validations.Add(new RequiredValidator());

            Property positionX = Properties.AddOrRetrieve(PropertyNames.SignPositionX, typeof(int), ValueUseOption.RuntimeRead, 0);

            positionX.Order       = propertyOrder++;
            positionX.Description = "X coordinate of the signature.";

            Property positionY = Properties.AddOrRetrieve(PropertyNames.SignPositionY, typeof(int), ValueUseOption.RuntimeRead, 0);

            positionY.Order       = propertyOrder++;
            positionY.Description = "Y coordinate of the signature.";

            Property width = Properties.AddOrRetrieve(PropertyNames.SignWidth, typeof(int), ValueUseOption.RuntimeRead, 100);

            width.Order       = propertyOrder++;
            width.Description = "Width of the signature box.";

            Property height = Properties.AddOrRetrieve(PropertyNames.SignHeight, typeof(int), ValueUseOption.RuntimeRead, 50);

            height.Order       = propertyOrder++;
            height.Description = "Height of the signature box.";

            Property backgroundImage = Properties.AddOrRetrieve(PropertyNames.SignBackgroundImage, typeof(string), ValueUseOption.RuntimeRead, string.Empty);

            backgroundImage.Order       = propertyOrder++;
            backgroundImage.Description = "Path to an image file to use as a background for the signature.";
            backgroundImage.Editor      = typeof(FilePathEditor);

            Property page = Properties.AddOrRetrieve(PropertyNames.SignPage, typeof(int), ValueUseOption.RuntimeRead, 1);

            page.Order       = propertyOrder++;
            page.Description = "Page on which to include the visible signature.";
            page.Validations.Add(new RangeValidator(1, int.MaxValue));

            applyVisibility(visibleDependency.Visible);
        }
コード例 #11
0
        public bool Equals(ContentTypeProperty input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Name == input.Name ||
                     (Name != null && Name.Equals(input.Name))
                     ) &&
                 (
                     RootPropertyName == input.RootPropertyName ||
                     (RootPropertyName != null && RootPropertyName.Equals(input.RootPropertyName))
                 ) &&
                 (
                     ReadableName == input.ReadableName ||
                     (ReadableName != null && ReadableName.Equals(input.ReadableName))
                 ) &&
                 (
                     Value == input.Value ||
                     (Value != null && Value.Equals(input.Value))
                 ) &&
                 (
                     PropertyDescription == input.PropertyDescription ||
                     (PropertyDescription != null && PropertyDescription.Equals(input.PropertyDescription))
                 ) &&
                 (
                     Localizable == input.Localizable ||
                     (Localizable != null && Localizable.Equals(input.Localizable))
                 ) &&
                 (
                     Fallback == input.Fallback ||
                     (Fallback != null && Fallback.Equals(input.Fallback))
                 ) &&
                 (
                     Enabled == input.Enabled ||
                     (Enabled != null && Enabled.Equals(input.Enabled))
                 ) &&
                 (
                     Order == input.Order ||
                     (Order.Equals(input.Order))
                 ) &&
                 (
                     Visible == input.Visible ||
                     (Visible != null && Visible.Equals(input.Visible))
                 ) &&
                 (
                     IsTitle == input.IsTitle ||
                     (IsTitle != null && IsTitle.Equals(input.IsTitle))
                 ) &&
                 (
                     Required == input.Required ||
                     (Required != null && Required.Equals(input.Required))
                 ) &&
                 (
                     MaxLength == input.MaxLength ||
                     (MaxLength.Equals(input.MaxLength))
                 ) &&
                 (
                     MaxByteLength == input.MaxByteLength ||
                     (MaxByteLength.Equals(input.MaxByteLength))
                 ) &&
                 (
                     MaxFileSize == input.MaxFileSize ||
                     (MaxFileSize.Equals(input.MaxFileSize))
                 ) &&
                 (
                     Regexp == input.Regexp ||
                     (Regexp != null && Regexp.Equals(input.Regexp))
                 ) &&
                 (
                     ValidateAs == input.ValidateAs ||
                     (ValidateAs != null && ValidateAs.Equals(input.ValidateAs))
                 ) &&
                 (
                     RssAttribute == input.RssAttribute ||
                     (RssAttribute != null && RssAttribute.Equals(input.RssAttribute))
                 ) &&
                 (
                     VisibleDependency == input.VisibleDependency ||
                     (VisibleDependency != null && VisibleDependency.Equals(input.VisibleDependency))
                 ) &&
                 (
                     VisibleOn == input.VisibleOn ||
                     (VisibleOn != null && VisibleOn.Equals(input.VisibleOn))
                 ) &&
                 (
                     Datatype == input.Datatype ||
                     (Datatype != null && Datatype.Equals(input.Datatype))
                 ) &&
                 (
                     Attributes == input.Attributes ||
                     (Attributes != null && Attributes.SequenceEqual(input.Attributes))
                 ) &&
                 (
                     ChildProperties == input.ChildProperties ||
                     (ChildProperties != null && ChildProperties.SequenceEqual(input.ChildProperties))
                 ) &&
                 (
                     ContentTypeAllowed == input.ContentTypeAllowed ||
                     (ContentTypeAllowed != null && ContentTypeAllowed.Equals(input.ContentTypeAllowed))
                 ) &&
                 (
                     BindToProperty == input.BindToProperty ||
                     (BindToProperty != null && BindToProperty.Equals(input.BindToProperty))
                 ) &&
                 (
                     BoundRegex == input.BoundRegex ||
                     (BoundRegex != null && BoundRegex.Equals(input.BoundRegex))
                 ) &&
                 (
                     RepresentationSelection == input.RepresentationSelection ||
                     (RepresentationSelection != null && RepresentationSelection.SequenceEqual(input.RepresentationSelection))
                 ) &&
                 (
                     DefaultValues == input.DefaultValues ||
                     (DefaultValues != null && DefaultValues.SequenceEqual(input.DefaultValues))
                 ) &&
                 (
                     IsExternalAllowed == input.IsExternalAllowed ||
                     (IsExternalAllowed != null && IsExternalAllowed.Equals(input.IsExternalAllowed))
                 ) &&
                 (
                     PropertySection == input.PropertySection ||
                     (PropertySection != null && PropertySection.Equals(input.PropertySection))
                 ) &&
                 (
                     Weight == input.Weight ||
                     (Weight.Equals(input.Weight))
                 ) &&
                 (
                     Entitytype == input.Entitytype ||
                     (Entitytype != null && Entitytype.Equals(input.Entitytype))
                 ) &&
                 (
                     IsCombo == input.IsCombo ||
                     (IsCombo != null && IsCombo.Equals(input.IsCombo))
                 ) &&
                 (
                     SuppressProperty == input.SuppressProperty ||
                     (SuppressProperty != null && SuppressProperty.Equals(input.SuppressProperty))
                 ) &&
                 (
                     LegalContentTypes == input.LegalContentTypes ||
                     (LegalContentTypes != null && LegalContentTypes.SequenceEqual(input.LegalContentTypes))
                 ) &&
                 (
                     RepresentationValidationString == input.RepresentationValidationString ||
                     (RepresentationValidationString != null && RepresentationValidationString.Equals(input.RepresentationValidationString))
                 ) &&
                 (
                     MinWidth == input.MinWidth ||
                     (MinWidth.Equals(input.MinWidth))
                 ) &&
                 (
                     MaxWidth == input.MaxWidth ||
                     (MaxWidth.Equals(input.MaxWidth))
                 ) &&
                 (
                     MinHeight == input.MinHeight ||
                     (MinHeight.Equals(input.MinHeight))
                 ) &&
                 (
                     MaxHeight == input.MaxHeight ||
                     (MaxHeight.Equals(input.MaxHeight))
                 ) &&
                 (
                     IsVideo == input.IsVideo ||
                     (IsVideo != null && IsVideo.Equals(input.IsVideo))
                 ) &&
                 (
                     IsImage == input.IsImage ||
                     (IsImage != null && IsImage.Equals(input.IsImage))
                 ));
        }
        public static void InitializeInputFileProperties(
            this PropertyCollection properties,
            string inputFilePathPropertyName,
            string authenticationTypePropertyName,
            string passwordPropertyName,
            string certificateSourcePropertyName,
            string certificateFilePathPropertyName,
            string certificateFilePasswordPropertyName,
            string certificatePropertyName,
            bool supportCertificateAuthentication,
            ref int propertyOrder,
            VisibleDependency visibleDependency)
        {
            var           certVisibleDependency = new VisibleDependency(() => visibleDependency.Visible && properties.PropertyValueEquals(authenticationTypePropertyName, AuthenticationType.Certificate));
            Action <bool> applyVisibility       = (isVisible) =>
            {
                AuthenticationType authenticationTypeValue = properties[authenticationTypePropertyName].GetValue <AuthenticationType>();

                properties[inputFilePathPropertyName].IsVisible      = isVisible;
                properties[authenticationTypePropertyName].IsVisible = isVisible;
                properties[passwordPropertyName].IsVisible           = (isVisible && authenticationTypeValue == AuthenticationType.Password);
            };
            EventHandler updateVisibility = (sender, args) =>
            {
                applyVisibility(visibleDependency.Visible);
                certVisibleDependency.Refresh();
            };

            visibleDependency.VisibleChanged += (visible) =>
            {
                applyVisibility(visible);
                certVisibleDependency.Refresh();
            };

            Property pdfFilePath = properties.AddOrRetrieve(inputFilePathPropertyName, typeof(string), ValueUseOption.RuntimeRead, string.Empty);

            pdfFilePath.Order       = propertyOrder++;
            pdfFilePath.Description = "Path to the PDF file.";
            pdfFilePath.Editor      = typeof(FilePathEditor);
            pdfFilePath.Validations.Add(new RequiredValidator());

            Property authenticationType = properties.AddOrRetrieve(authenticationTypePropertyName, typeof(AuthenticationType), ValueUseOption.DesignTime, AuthenticationType.None);

            authenticationType.Order       = propertyOrder++;
            authenticationType.Description = "Authentication type required to open the PDF file.";
            if (!supportCertificateAuthentication)
            {
                authenticationType.Validations.Add(new CertificateAuthenticationValidator());
            }
            authenticationType.ValueChanged += updateVisibility;

            Property pdfPassword = properties.AddOrRetrieve(passwordPropertyName, typeof(string), ValueUseOption.RuntimeRead, string.Empty);

            pdfPassword.Order       = propertyOrder++;
            pdfPassword.Description = "Password required to access the PDF file.";
            pdfPassword.Validations.Add(new RequiredValidator());

            properties.InitializeCertificateProperties(
                certificateSourcePropertyName,
                certificateFilePathPropertyName,
                certificateFilePasswordPropertyName,
                certificatePropertyName,
                ref propertyOrder,
                certVisibleDependency);

            applyVisibility(visibleDependency.Visible);
        }