public static RequestAttributes ToAllowedFlagsSet(this RequestAttributes restrictTo)
{
if (restrictTo == RequestAttributes.Any)
return RequestAttributes.Any;
var allowedAttrs = RequestAttributes.None;
//Network access
if (!HasAnyRestrictionsOf(restrictTo, RequestAttributes.AnyNetworkAccessType))
allowedAttrs |= RequestAttributes.AnyNetworkAccessType;
else
allowedAttrs |= (restrictTo & RequestAttributes.AnyNetworkAccessType);
//Security
if (!HasAnyRestrictionsOf(restrictTo, RequestAttributes.AnySecurityMode))
allowedAttrs |= RequestAttributes.AnySecurityMode;
else
allowedAttrs |= (restrictTo & RequestAttributes.AnySecurityMode);
//Http Method
if (!HasAnyRestrictionsOf(restrictTo, RequestAttributes.AnyHttpMethod))
allowedAttrs |= RequestAttributes.AnyHttpMethod;
else
allowedAttrs |= (restrictTo & RequestAttributes.AnyHttpMethod);
//Call Style
if (!HasAnyRestrictionsOf(restrictTo, RequestAttributes.AnyCallStyle))
allowedAttrs |= RequestAttributes.AnyCallStyle;
else
allowedAttrs |= (restrictTo & RequestAttributes.AnyCallStyle);
//Format
if (!HasAnyRestrictionsOf(restrictTo, RequestAttributes.AnyFormat))
allowedAttrs |= RequestAttributes.AnyFormat;
else
allowedAttrs |= (restrictTo & RequestAttributes.AnyFormat);
//Endpoint
if (!HasAnyRestrictionsOf(restrictTo, RequestAttributes.AnyEndpoint))
allowedAttrs |= RequestAttributes.AnyEndpoint;
else
allowedAttrs |= (restrictTo & RequestAttributes.AnyEndpoint);
return allowedAttrs;
}