Beispiel #1
0
        //When Create(...) is used, we delay finding the enum value
        //until the enum value is needed, avoiding the string comparisons if possible
        void DetectScope()
        {
            if (RedirectionUtility.IsNamespaceMatch(this.Namespace, RedirectionConstants.Namespace))
            {
                if (string.Equals(this.Value, RedirectionConstants.Scope.Message, StringComparison.Ordinal))
                {
                    this.internalScope = InternalRedirectionScope.Message;
                }
                else if (string.Equals(this.Value, RedirectionConstants.Scope.Session, StringComparison.Ordinal))
                {
                    this.internalScope = InternalRedirectionScope.Session;
                }
                else if (string.Equals(this.Value, RedirectionConstants.Scope.Endpoint, StringComparison.Ordinal))
                {
                    this.internalScope = InternalRedirectionScope.Endpoint;
                }
                else
                {
                    this.internalScope = InternalRedirectionScope.Custom;
                }
            }
            else
            {
                this.internalScope = InternalRedirectionScope.Custom;
            }

            Fx.Assert(this.internalScope != InternalRedirectionScope.Unknown, "Failed to correctly detect internal redirection scope");
        }
Beispiel #2
0
 private void DetectScope()
 {
     if (RedirectionUtility.IsNamespaceMatch(this.Namespace, "http://schemas.microsoft.com/ws/2008/06/redirect"))
     {
         if (string.Equals(this.Value, "Message", StringComparison.Ordinal))
         {
             this.internalScope = InternalRedirectionScope.Message;
         }
         else if (string.Equals(this.Value, "Session", StringComparison.Ordinal))
         {
             this.internalScope = InternalRedirectionScope.Session;
         }
         else if (string.Equals(this.Value, "Endpoint", StringComparison.Ordinal))
         {
             this.internalScope = InternalRedirectionScope.Endpoint;
         }
         else
         {
             this.internalScope = InternalRedirectionScope.Custom;
         }
     }
     else
     {
         this.internalScope = InternalRedirectionScope.Custom;
     }
 }
Beispiel #3
0
        //When Create(...) is used, we delay finding the enum value
        //until the enum value is needed, avoiding the string comparisons if possible
        void DetectType()
        {
            if (RedirectionUtility.IsNamespaceMatch(this.Namespace, RedirectionConstants.Namespace))
            {
                if (string.Equals(this.Value, RedirectionConstants.Type.Cache, StringComparison.Ordinal))
                {
                    this.internalType = InternalRedirectionType.Cache;
                }
                else if (string.Equals(this.Value, RedirectionConstants.Type.Resource, StringComparison.Ordinal))
                {
                    this.internalType = InternalRedirectionType.Resource;
                }
                else if (string.Equals(this.Value, RedirectionConstants.Type.UseIntermediary, StringComparison.Ordinal))
                {
                    this.internalType = InternalRedirectionType.UseIntermediary;
                }
                else
                {
                    this.internalType = InternalRedirectionType.Custom;
                }
            }
            else
            {
                this.internalType = InternalRedirectionType.Custom;
            }

            Fx.Assert(this.internalType != InternalRedirectionType.Unknown, "Failed to correctly detect internal redirection type");
        }
Beispiel #4
0
 private void DetectType()
 {
     if (RedirectionUtility.IsNamespaceMatch(this.Namespace, "http://schemas.microsoft.com/ws/2008/06/redirect"))
     {
         if (string.Equals(this.Value, "Cache", StringComparison.Ordinal))
         {
             this.internalType = InternalRedirectionType.Cache;
         }
         else if (string.Equals(this.Value, "Resource", StringComparison.Ordinal))
         {
             this.internalType = InternalRedirectionType.Resource;
         }
         else if (string.Equals(this.Value, "UseIntermediary", StringComparison.Ordinal))
         {
             this.internalType = InternalRedirectionType.UseIntermediary;
         }
         else
         {
             this.internalType = InternalRedirectionType.Custom;
         }
     }
     else
     {
         this.internalType = InternalRedirectionType.Custom;
     }
 }
Beispiel #5
0
 public override int GetHashCode()
 {
     if (!this.hashCode.HasValue)
     {
         this.hashCode = new int?(RedirectionUtility.ComputeHashCode(this.Value, this.Namespace));
     }
     return(this.hashCode.Value);
 }
Beispiel #6
0
        public override int GetHashCode()
        {
            if (this.hashCode == null)
            {
                this.hashCode = RedirectionUtility.ComputeHashCode(this.Value, this.Namespace);
            }

            return(this.hashCode.Value);
        }
Beispiel #7
0
        public static bool operator ==(RedirectionScope left, RedirectionScope right)
        {
            bool flag = false;

            if ((left == null) && (right == null))
            {
                return(true);
            }
            if ((left == null) || (right == null))
            {
                return(flag);
            }
            return((left.InternalScope == right.InternalScope) || RedirectionUtility.IsNamespaceAndValueMatch(left.Value, left.Namespace, right.Value, right.Namespace));
        }
 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;
     }
 }
Beispiel #9
0
        public static bool operator ==(RedirectionScope left, RedirectionScope right)
        {
            bool result = false;

            if ((object)left == (object)null && (object)right == (object)null)
            {
                result = true;
            }
            else if ((object)left != (object)null && (object)right != (object)null)
            {
                if (left.InternalScope == right.InternalScope)
                {
                    result = true;
                }
                else
                {
                    result = RedirectionUtility.IsNamespaceAndValueMatch(left.Value,
                                                                         left.Namespace, right.Value, right.Namespace);
                }
            }

            return(result);
        }
Beispiel #10
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");
        }