public ConfigurationInformationProvider(IPerTenantRMSTrustedPublishingDomainConfiguration perTenantconfig)
        {
            this.serverLicensorCertificate             = new ConfigurationInformationProvider.ServerLicensorCertInformation(ConfigurationInformationProvider.GetTrustedDomainChainArrayFromCompressedString(perTenantconfig.CompressedSLCCertChain));
            this.serverLicensorCertificate.IsValidated = true;
            List <string[]> list = new List <string[]>(perTenantconfig.CompressedTrustedDomainChains.Count);

            foreach (string compressedCertChainString in perTenantconfig.CompressedTrustedDomainChains)
            {
                list.Add(ConfigurationInformationProvider.GetTrustedDomainChainArrayFromCompressedString(compressedCertChainString));
            }
            this.trustedUserDomains             = new ConfigurationInformationProvider.TrustedDomainInformation(list);
            this.trustedUserDomains.IsValidated = true;
            this.trustedPublishingDomains       = this.trustedUserDomains;
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            foreach (string compressedTemplateString in perTenantconfig.CompressedRMSTemplates)
            {
                string templateFromCompressedString = ConfigurationInformationProvider.GetTemplateFromCompressedString(compressedTemplateString);
                Guid   templateGuidFromLicense;
                try
                {
                    templateGuidFromLicense = DrmClientUtils.GetTemplateGuidFromLicense(templateFromCompressedString);
                }
                catch (RightsManagementException ex)
                {
                    throw new ConfigurationProviderException(true, "ConfigurationInformationProvider failed to parse template data for tenant ", ex);
                }
                dictionary.Add(templateGuidFromLicense.ToString("B"), templateFromCompressedString);
            }
            this.rightsTemplateInformation                 = new ConfigurationInformationProvider.RightsTemplateInformation(dictionary);
            this.licensingIntranetDistributionPointUrl     = perTenantconfig.IntranetLicensingUrl;
            this.licensingExtranetDistributionPointUrl     = perTenantconfig.ExtranetLicensingUrl;
            this.certificationIntranetDistributionPointUrl = perTenantconfig.IntranetCertificationUrl;
            this.certificationExtranetDistributionPointUrl = perTenantconfig.ExtranetCertificationUrl;
        }
        public void Save(IConfigurable instance)
        {
            if (this.orgId == OrganizationId.ForestWideOrgId)
            {
                throw new NotSupportedException();
            }
            RmsTemplatePresentation rmsTemplatePresentation = instance as RmsTemplatePresentation;

            if (rmsTemplatePresentation == null)
            {
                throw new ArgumentException("passed in instance not of type RmsTemplatePresentation", "instance");
            }
            Guid templateGuid = rmsTemplatePresentation.TemplateGuid;
            RMSTrustedPublishingDomain rmstrustedPublishingDomain = this.FindDefaultTPD();

            if (rmstrustedPublishingDomain == null)
            {
                return;
            }
            if (!MultiValuedPropertyBase.IsNullOrEmpty(rmstrustedPublishingDomain.RMSTemplates))
            {
                string text  = null;
                string text2 = null;
                foreach (string text3 in rmstrustedPublishingDomain.RMSTemplates)
                {
                    RmsTemplateType rmsTemplateType;
                    string          text4 = RMUtil.DecompressTemplate(text3, out rmsTemplateType);
                    Guid            templateGuidFromLicense = DrmClientUtils.GetTemplateGuidFromLicense(text4);
                    if (templateGuidFromLicense == templateGuid && rmsTemplateType != rmsTemplatePresentation.Type)
                    {
                        text  = text3;
                        text2 = RMUtil.CompressTemplate(text4, rmsTemplatePresentation.Type);
                        break;
                    }
                }
                if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(text2))
                {
                    rmstrustedPublishingDomain.RMSTemplates.Remove(text);
                    rmstrustedPublishingDomain.RMSTemplates.Add(text2);
                    this.adSession.Save(rmstrustedPublishingDomain);
                }
            }
        }