private RedirectionDuration(string duration, string ns)
 {
     this.hashCode         = null;
     this.Value            = duration;
     this.Namespace        = ns;
     this.internalDuration = InternalRedirectionDuration.Unknown;
 }
        private RedirectionDuration(InternalRedirectionDuration duration)
        {
            this.hashCode         = null;
            this.Namespace        = "http://schemas.microsoft.com/ws/2008/06/redirect";
            this.internalDuration = duration;
            switch (duration)
            {
            case InternalRedirectionDuration.Temporary:
                this.Value = "Temporary";
                return;

            case InternalRedirectionDuration.Permanent:
                this.Value = "Permanent";
                return;
            }
        }
        //should be used for known durations only
        RedirectionDuration(InternalRedirectionDuration duration)
        {
            this.Namespace = RedirectionConstants.Namespace;
            this.internalDuration = duration;

            switch (duration)
            {
                case InternalRedirectionDuration.Temporary:
                    this.Value = RedirectionConstants.Duration.Temporary;
                    break;
                case InternalRedirectionDuration.Permanent:
                    this.Value = RedirectionConstants.Duration.Permanent;
                    break;
                default:
                    Fx.Assert("This constructor doesn't support the following enum value: " + duration);
                    break;
            }
        }
示例#4
0
        //should be used for known durations only
        RedirectionDuration(InternalRedirectionDuration duration)
        {
            this.Namespace        = RedirectionConstants.Namespace;
            this.internalDuration = duration;

            switch (duration)
            {
            case InternalRedirectionDuration.Temporary:
                this.Value = RedirectionConstants.Duration.Temporary;
                break;

            case InternalRedirectionDuration.Permanent:
                this.Value = RedirectionConstants.Duration.Permanent;
                break;

            default:
                Fx.Assert("This constructor doesn't support the following enum value: " + duration);
                break;
            }
        }
 private void DetectDuration()
 {
     if (RedirectionUtility.IsNamespaceMatch(this.Namespace, "http://schemas.microsoft.com/ws/2008/06/redirect"))
     {
         if (string.Equals(this.Value, "Temporary", StringComparison.Ordinal))
         {
             this.internalDuration = InternalRedirectionDuration.Temporary;
         }
         else if (string.Equals(this.Value, "Permanent", StringComparison.Ordinal))
         {
             this.internalDuration = InternalRedirectionDuration.Permanent;
         }
         else
         {
             this.internalDuration = InternalRedirectionDuration.Custom;
         }
     }
     else
     {
         this.internalDuration = InternalRedirectionDuration.Custom;
     }
 }
示例#6
0
        //When Create(...) is used, we delay finding the enum value
        //until the enum value is needed, avoiding the string comparisons if possible
        void DetectDuration()
        {
            if (RedirectionUtility.IsNamespaceMatch(this.Namespace, RedirectionConstants.Namespace))
            {
                if (string.Equals(this.Value, RedirectionConstants.Duration.Temporary, StringComparison.Ordinal))
                {
                    this.internalDuration = InternalRedirectionDuration.Temporary;
                }
                else if (string.Equals(this.Value, RedirectionConstants.Duration.Permanent, StringComparison.Ordinal))
                {
                    this.internalDuration = InternalRedirectionDuration.Permanent;
                }
                else
                {
                    this.internalDuration = InternalRedirectionDuration.Custom;
                }
            }
            else
            {
                this.internalDuration = InternalRedirectionDuration.Custom;
            }

            Fx.Assert(this.internalDuration != InternalRedirectionDuration.Unknown, "Failed to correctly detect internal redirection duration");
        }
 RedirectionDuration(string duration, string ns)
 {
     this.Value = duration;
     this.Namespace = ns;
     this.internalDuration = InternalRedirectionDuration.Unknown;
 }
        //When Create(...) is used, we delay finding the enum value
        //until the enum value is needed, avoiding the string comparisons if possible 
        void DetectDuration()
        {
            if (RedirectionUtility.IsNamespaceMatch(this.Namespace, RedirectionConstants.Namespace))
            {
                if (string.Equals(this.Value, RedirectionConstants.Duration.Temporary, StringComparison.Ordinal))
                {
                    this.internalDuration = InternalRedirectionDuration.Temporary;
                }
                else if (string.Equals(this.Value, RedirectionConstants.Duration.Permanent, StringComparison.Ordinal))
                {
                    this.internalDuration = InternalRedirectionDuration.Permanent;
                }
                else
                {
                    this.internalDuration = InternalRedirectionDuration.Custom;
                }
            }
            else
            {
                this.internalDuration = InternalRedirectionDuration.Custom;
            }

            Fx.Assert(this.internalDuration != InternalRedirectionDuration.Unknown, "Failed to correctly detect internal redirection duration");
        }