コード例 #1
0
 public CustomODataRoute(
     string routePrefix,
     ODataPathRouteConstraint pathConstraint,
     HttpRouteValueDictionary defaults,
     HttpRouteValueDictionary constraints,
     HttpRouteValueDictionary dataTokens,
     HttpMessageHandler handler)
     : base(routePrefix, pathConstraint, defaults, constraints, dataTokens, handler)
 {
     _canGenerateDirectLink = routePrefix != null && RoutePrefix.IndexOf('{') == -1;
 }
コード例 #2
0
        public string OffSet(string ipAddress, bool v6 = false, int offset = 0, bool hasPrefix = false)
        {
            var route = new RoutePrefix(ipAddress);

            if (route.StartOfPrefixBigInt % 2 != 0)
            {
                if (!v6)
                {
                    return(hasPrefix
                               ? $"{(route.StartOfPrefixBigInt + offset).ToIpAddress(AddressFamily.InterNetwork)}/{route.PrefixMaskWidth}"
                               : (route.StartOfPrefixBigInt + offset).ToIpAddress(AddressFamily.InterNetwork)
                           .ToString());
                }
            }
            return(hasPrefix
                       ? $"{(route.StartOfPrefixBigInt + offset).ToIpAddress(AddressFamily.InterNetworkV6)}/{route.PrefixMaskWidth}"
                       : (route.StartOfPrefixBigInt + offset).ToIpAddress(AddressFamily.InterNetworkV6).ToString());
        }
コード例 #3
0
 public CustomODataRoute(string routePrefix, ODataPathRouteConstraint pathConstraint)
     : base(routePrefix, pathConstraint)
 {
     _canGenerateDirectLink = routePrefix != null && RoutePrefix.IndexOf('{') == -1;
 }