Ejemplo n.º 1
0
        protected override void ValidateWithDataObject(IConfigurable dataObject)
        {
            base.ValidateWithDataObject(dataObject);
            IMAPSubscriptionProxy imapsubscriptionProxy = dataObject as IMAPSubscriptionProxy;

            if (imapsubscriptionProxy == null)
            {
                throw new InvalidCastException("Expected dataObject of IMAPSubscriptionProxy type");
            }
            IMAPSubscriptionProxy imapsubscriptionProxy2 = IMAPSubscriptionProxy.ShallowCopy(imapsubscriptionProxy);

            if (base.Fields.IsModified("EmailAddress"))
            {
                imapsubscriptionProxy2.EmailAddress = base.EmailAddress;
            }
            if (base.Fields.IsModified("IncomingUserName"))
            {
                imapsubscriptionProxy2.IncomingUserName = base.IncomingUserName;
            }
            if (base.Fields.IsModified("IncomingServer"))
            {
                imapsubscriptionProxy2.IncomingServer = base.IncomingServer;
            }
            if (base.Fields.IsModified("IncomingPort"))
            {
                imapsubscriptionProxy2.IncomingPort = base.IncomingPort;
            }
            if (base.Fields.IsModified("IncomingAuth"))
            {
                imapsubscriptionProxy2.IncomingAuthentication = this.IncomingAuth;
            }
            if (base.Fields.IsModified("IncomingSecurity"))
            {
                imapsubscriptionProxy2.IncomingSecurity = this.IncomingSecurity;
            }
            AggregationTaskUtils.ValidateUserName(imapsubscriptionProxy2.IncomingUserName, new Task.TaskErrorLoggingDelegate(base.WriteDebugInfoAndError));
            SecureString password = this.password ?? imapsubscriptionProxy.Subscription.LogonPasswordSecured;

            if (imapsubscriptionProxy2.IncomingAuthentication == IMAPAuthenticationMechanism.Basic)
            {
                AggregationTaskUtils.ValidateUnicodeInfoOnUserNameAndPassword(imapsubscriptionProxy2.IncomingUserName, password, new Task.TaskErrorLoggingDelegate(base.WriteDebugInfoAndError));
            }
            AggregationTaskUtils.ValidateIncomingServerLength(imapsubscriptionProxy2.IncomingServer, new Task.TaskErrorLoggingDelegate(base.WriteDebugInfoAndError));
            bool      skipAccountVerification = base.ShouldSkipAccountValidation();
            Exception ex = NewImapSubscription.ValidateSubscription(imapsubscriptionProxy2, password, skipAccountVerification);

            if (ex != null)
            {
                base.WriteDebugInfoAndError(ex, (ErrorCategory)1003, imapsubscriptionProxy2);
            }
        }
Ejemplo n.º 2
0
        protected override void InternalBeginProcessing()
        {
            TaskLogger.LogEnter();
            base.InternalBeginProcessing();
            IMAPSubscriptionProxy dataObject = this.DataObject;

            if (dataObject.IncomingAuthentication == IMAPAuthenticationMechanism.Basic)
            {
                AggregationTaskUtils.ValidateUnicodeInfoOnUserNameAndPassword(dataObject.IncomingUserName, this.password, new Task.TaskErrorLoggingDelegate(base.WriteDebugInfoAndError));
            }
            AggregationTaskUtils.ValidateIncomingServerLength(dataObject.IncomingServer, new Task.TaskErrorLoggingDelegate(base.WriteDebugInfoAndError));
            Exception ex = NewImapSubscription.ValidateSubscription(dataObject, this.password, this.Force);

            if (ex != null)
            {
                base.WriteDebugInfoAndError(ex, (ErrorCategory)1003, this.DataObject);
            }
            this.DataObject.SetPassword(this.password);
            base.WriteDebugInfo();
            TaskLogger.LogExit();
        }