public static IConfigurable PrepareDataObject(PropertyBag fields, HybridConfiguration dataObject, IConfigDataProvider dataSession, HybridConfigurationTaskUtility.GetUniqueObject getDataObjectFunc, Task.TaskErrorLoggingDelegate writeErrorFunc)
        {
            MultiValuedProperty <ADObjectId> clientAccessServers = dataObject.ClientAccessServers;

            if (fields.IsModified("ClientAccessServers"))
            {
                ADPropertyDefinition clientAccessServers2 = HybridConfigurationSchema.ClientAccessServers;
                HybridConfigurationTaskUtility.ServerCriterion[] array = new HybridConfigurationTaskUtility.ServerCriterion[2];
                array[0] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsClientAccessServer, new Func <string, LocalizedString>(HybridStrings.HybridErrorServerNotCAS));
                array[1] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsE14OrLater, new Func <string, LocalizedString>(HybridStrings.HybridErrorServerNotE14CAS));
                dataObject.ClientAccessServers = HybridConfigurationTaskUtility.ValidateServers(clientAccessServers2, dataSession, fields, getDataObjectFunc, writeErrorFunc, array);
            }
            if (fields.IsModified("SendingTransportServers"))
            {
                ADPropertyDefinition sendingTransportServers            = HybridConfigurationSchema.SendingTransportServers;
                HybridConfigurationTaskUtility.ServerCriterion[] array2 = new HybridConfigurationTaskUtility.ServerCriterion[2];
                array2[0] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsHubTransportServer, new Func <string, LocalizedString>(HybridStrings.HybridErrorSendingTransportServerNotHub));
                array2[1] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsE15OrLater, new Func <string, LocalizedString>(HybridStrings.HybridErrorSendingTransportServerNotE15Hub));
                dataObject.SendingTransportServers = HybridConfigurationTaskUtility.ValidateServers(sendingTransportServers, dataSession, fields, getDataObjectFunc, writeErrorFunc, array2);
            }
            if (fields.IsModified("ReceivingTransportServers"))
            {
                ADPropertyDefinition receivingTransportServers          = HybridConfigurationSchema.ReceivingTransportServers;
                HybridConfigurationTaskUtility.ServerCriterion[] array3 = new HybridConfigurationTaskUtility.ServerCriterion[2];
                array3[0] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsFrontendTransportServer, new Func <string, LocalizedString>(HybridStrings.HybridErrorReceivingTransportServerNotFrontEnd));
                array3[1] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsE15OrLater, new Func <string, LocalizedString>(HybridStrings.HybridErrorReceivingTransportServerNotE15FrontEnd));
                dataObject.ReceivingTransportServers = HybridConfigurationTaskUtility.ValidateServers(receivingTransportServers, dataSession, fields, getDataObjectFunc, writeErrorFunc, array3);
            }
            if (fields.IsModified("EdgeTransportServers"))
            {
                ADPropertyDefinition edgeTransportServers = HybridConfigurationSchema.EdgeTransportServers;
                HybridConfigurationTaskUtility.ServerCriterion[] array4 = new HybridConfigurationTaskUtility.ServerCriterion[2];
                array4[0] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsEdgeServer, new Func <string, LocalizedString>(HybridStrings.HybridErrorServerNotEdge));
                array4[1] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsE14Sp1OrLater, new Func <string, LocalizedString>(HybridStrings.HybridErrorServerNotE14Edge));
                dataObject.EdgeTransportServers = HybridConfigurationTaskUtility.ValidateServers(edgeTransportServers, dataSession, fields, getDataObjectFunc, writeErrorFunc, array4);
            }
            if (fields.IsModified("TlsCertificateName"))
            {
                string text = fields["TlsCertificateName"] as string;
                dataObject.TlsCertificateName = ((text == null) ? null : SmtpX509Identifier.Parse(text));
            }
            if (fields.IsModified("OnPremisesSmartHost"))
            {
                dataObject.OnPremisesSmartHost = (SmtpDomain)fields["OnPremisesSmartHost"];
            }
            if (fields.IsModified("Domains"))
            {
                dataObject.Domains = (MultiValuedProperty <AutoDiscoverSmtpDomain>)fields["Domains"];
            }
            if (fields.IsModified("Features"))
            {
                dataObject.Features = (MultiValuedProperty <HybridFeature>)fields["Features"];
            }
            if (fields.IsModified("ExternalIPAddresses"))
            {
                dataObject.ExternalIPAddresses = HybridConfigurationTaskUtility.ValidateExternalIPAddresses((MultiValuedProperty <IPRange>)fields["ExternalIPAddresses"], writeErrorFunc);
            }
            if (fields.IsModified("ServiceInstance"))
            {
                dataObject.ServiceInstance = (int)fields["ServiceInstance"];
            }
            return(dataObject);
        }
Esempio n. 2
0
        protected override IConfigurable PrepareDataObject()
        {
            HybridConfiguration   hybridConfiguration = (HybridConfiguration)base.PrepareDataObject();
            IConfigurationSession session             = base.DataSession as IConfigurationSession;

            hybridConfiguration.SetId(session, "Hybrid Configuration");
            if (base.Fields.IsModified("ClientAccessServers"))
            {
                HybridConfiguration  hybridConfiguration2 = hybridConfiguration;
                ADPropertyDefinition clientAccessServers  = HybridConfigurationSchema.ClientAccessServers;
                IConfigDataProvider  dataSession          = base.DataSession;
                MultiValuedProperty <ServerIdParameter>        clientAccessServers2 = this.ClientAccessServers;
                HybridConfigurationTaskUtility.GetUniqueObject getServer            = new HybridConfigurationTaskUtility.GetUniqueObject(base.GetDataObject <Server>);
                Task.TaskErrorLoggingDelegate writeError = new Task.TaskErrorLoggingDelegate(base.WriteError);
                HybridConfigurationTaskUtility.ServerCriterion[] array = new HybridConfigurationTaskUtility.ServerCriterion[2];
                array[0] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsClientAccessServer, new Func <string, LocalizedString>(HybridStrings.HybridErrorServerNotCAS));
                array[1] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsE14OrLater, new Func <string, LocalizedString>(HybridStrings.HybridErrorServerNotE14CAS));
                hybridConfiguration2.ClientAccessServers = HybridConfigurationTaskUtility.ValidateServers(clientAccessServers, dataSession, clientAccessServers2, getServer, writeError, array);
            }
            if (base.Fields.IsModified("SendingTransportServers"))
            {
                HybridConfiguration  hybridConfiguration3    = hybridConfiguration;
                ADPropertyDefinition sendingTransportServers = HybridConfigurationSchema.SendingTransportServers;
                IConfigDataProvider  dataSession2            = base.DataSession;
                MultiValuedProperty <ServerIdParameter>        sendingTransportServers2 = this.SendingTransportServers;
                HybridConfigurationTaskUtility.GetUniqueObject getServer2 = new HybridConfigurationTaskUtility.GetUniqueObject(base.GetDataObject <Server>);
                Task.TaskErrorLoggingDelegate writeError2 = new Task.TaskErrorLoggingDelegate(base.WriteError);
                HybridConfigurationTaskUtility.ServerCriterion[] array2 = new HybridConfigurationTaskUtility.ServerCriterion[2];
                array2[0] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsHubTransportServer, new Func <string, LocalizedString>(HybridStrings.HybridErrorSendingTransportServerNotHub));
                array2[1] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsE15OrLater, new Func <string, LocalizedString>(HybridStrings.HybridErrorSendingTransportServerNotE15Hub));
                hybridConfiguration3.SendingTransportServers = HybridConfigurationTaskUtility.ValidateServers(sendingTransportServers, dataSession2, sendingTransportServers2, getServer2, writeError2, array2);
            }
            if (base.Fields.IsModified("ReceivingTransportServers"))
            {
                HybridConfiguration  hybridConfiguration4      = hybridConfiguration;
                ADPropertyDefinition receivingTransportServers = HybridConfigurationSchema.ReceivingTransportServers;
                IConfigDataProvider  dataSession3 = base.DataSession;
                MultiValuedProperty <ServerIdParameter>        receivingTransportServers2 = this.ReceivingTransportServers;
                HybridConfigurationTaskUtility.GetUniqueObject getServer3 = new HybridConfigurationTaskUtility.GetUniqueObject(base.GetDataObject <Server>);
                Task.TaskErrorLoggingDelegate writeError3 = new Task.TaskErrorLoggingDelegate(base.WriteError);
                HybridConfigurationTaskUtility.ServerCriterion[] array3 = new HybridConfigurationTaskUtility.ServerCriterion[2];
                array3[0] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsFrontendTransportServer, new Func <string, LocalizedString>(HybridStrings.HybridErrorReceivingTransportServerNotFrontEnd));
                array3[1] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsE15OrLater, new Func <string, LocalizedString>(HybridStrings.HybridErrorReceivingTransportServerNotE15FrontEnd));
                hybridConfiguration4.ReceivingTransportServers = HybridConfigurationTaskUtility.ValidateServers(receivingTransportServers, dataSession3, receivingTransportServers2, getServer3, writeError3, array3);
            }
            if (base.Fields.IsModified("EdgeTransportServers"))
            {
                HybridConfiguration  hybridConfiguration5 = hybridConfiguration;
                ADPropertyDefinition edgeTransportServers = HybridConfigurationSchema.EdgeTransportServers;
                IConfigDataProvider  dataSession4         = base.DataSession;
                MultiValuedProperty <ServerIdParameter>        edgeTransportServers2 = this.EdgeTransportServers;
                HybridConfigurationTaskUtility.GetUniqueObject getServer4            = new HybridConfigurationTaskUtility.GetUniqueObject(base.GetDataObject <Server>);
                Task.TaskErrorLoggingDelegate writeError4 = new Task.TaskErrorLoggingDelegate(base.WriteError);
                HybridConfigurationTaskUtility.ServerCriterion[] array4 = new HybridConfigurationTaskUtility.ServerCriterion[2];
                array4[0] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsEdgeServer, new Func <string, LocalizedString>(HybridStrings.HybridErrorServerNotEdge));
                array4[1] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsE14Sp1OrLater, new Func <string, LocalizedString>(HybridStrings.HybridErrorServerNotE14Edge));
                hybridConfiguration5.EdgeTransportServers = HybridConfigurationTaskUtility.ValidateServers(edgeTransportServers, dataSession4, edgeTransportServers2, getServer4, writeError4, array4);
            }
            if (base.Fields.IsModified("TlsCertificateName"))
            {
                this.DataObject.TlsCertificateName = this.TlsCertificateName;
            }
            if (base.Fields.IsModified("OnPremisesSmartHost"))
            {
                this.DataObject.OnPremisesSmartHost = this.OnPremisesSmartHost;
            }
            if (base.Fields.IsModified("Domains"))
            {
                this.DataObject.Domains = this.Domains;
            }
            if (base.Fields.IsModified("Features"))
            {
                this.DataObject.Features = this.Features;
            }
            if (base.Fields.IsModified("ExternalIPAddresses"))
            {
                this.DataObject.ExternalIPAddresses = HybridConfigurationTaskUtility.ValidateExternalIPAddresses(this.ExternalIPAddresses, new Task.TaskErrorLoggingDelegate(base.WriteError));
            }
            if (base.Fields.IsModified("ServiceInstance"))
            {
                this.DataObject.ServiceInstance = this.ServiceInstance;
            }
            return(hybridConfiguration);
        }