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;
     }
 }
示例#2
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");
        }
 private RedirectionType(string value, string ns)
 {
     this.hashCode = null;
     this.Value = value;
     this.Namespace = ns;
     this.internalType = InternalRedirectionType.Unknown;
 }
示例#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;
     }
 }
示例#5
0
 private RedirectionType(string value, string ns)
 {
     this.hashCode     = null;
     this.Value        = value;
     this.Namespace    = ns;
     this.internalType = InternalRedirectionType.Unknown;
 }
        RedirectionType(string value, string ns)
        {
            this.Value = value;
            this.Namespace = ns;

            //delay comparing strings until needed...
            this.internalType = InternalRedirectionType.Unknown;
        }
示例#7
0
        RedirectionType(string value, string ns)
        {
            this.Value     = value;
            this.Namespace = ns;

            //delay comparing strings until needed...
            this.internalType = InternalRedirectionType.Unknown;
        }
        private RedirectionType(InternalRedirectionType type)
        {
            this.hashCode = null;
            this.Namespace = "http://schemas.microsoft.com/ws/2008/06/redirect";
            this.internalType = type;
            switch (type)
            {
                case InternalRedirectionType.Cache:
                    this.Value = "Cache";
                    return;

                case InternalRedirectionType.UseIntermediary:
                    this.Value = "UseIntermediary";
                    return;

                case InternalRedirectionType.Resource:
                    this.Value = "Resource";
                    return;
            }
        }
示例#9
0
        private RedirectionType(InternalRedirectionType type)
        {
            this.hashCode     = null;
            this.Namespace    = "http://schemas.microsoft.com/ws/2008/06/redirect";
            this.internalType = type;
            switch (type)
            {
            case InternalRedirectionType.Cache:
                this.Value = "Cache";
                return;

            case InternalRedirectionType.UseIntermediary:
                this.Value = "UseIntermediary";
                return;

            case InternalRedirectionType.Resource:
                this.Value = "Resource";
                return;
            }
        }
        //should be used for known types only
        RedirectionType(InternalRedirectionType type)
        {
            this.Namespace = RedirectionConstants.Namespace;
            this.internalType = type;

            switch (type)
            {
                case InternalRedirectionType.Cache:
                    this.Value = RedirectionConstants.Type.Cache;
                    break;
                case InternalRedirectionType.Resource:
                    this.Value = RedirectionConstants.Type.Resource;
                    break;
                case InternalRedirectionType.UseIntermediary:
                    this.Value = RedirectionConstants.Type.UseIntermediary;
                    break;
                default:
                    Fx.Assert("This constructor doesn't support the following enum value: " + type);
                    break;
            }
        }
示例#11
0
        //should be used for known types only
        RedirectionType(InternalRedirectionType type)
        {
            this.Namespace    = RedirectionConstants.Namespace;
            this.internalType = type;

            switch (type)
            {
            case InternalRedirectionType.Cache:
                this.Value = RedirectionConstants.Type.Cache;
                break;

            case InternalRedirectionType.Resource:
                this.Value = RedirectionConstants.Type.Resource;
                break;

            case InternalRedirectionType.UseIntermediary:
                this.Value = RedirectionConstants.Type.UseIntermediary;
                break;

            default:
                Fx.Assert("This constructor doesn't support the following enum value: " + type);
                break;
            }
        }
        //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");
        }