Example #1
0
        public static NetworkEndPoint Create(string expression)
        {
            ThrowHelper.ArgumentNull((expression == null), nameof(expression));

            Match match = Regex.Match(expression, RegexConstant.GetFullRegularExpression(RegularExpression));

            if (!match.Success)
            {
                return(null);
            }

            Group hostGroup = match.Groups[RegularExpressionGroupName_Host];
            Group portGroup = match.Groups[RegularExpressionGroupName_Port];

            string host = hostGroup.Value;
            int    port = 0;

            if (portGroup.Success)
            {
                port = Convert.ToInt32(portGroup.Value);
            }

            NetworkEndPoint point = new NetworkEndPoint(host, port);

            return(point);
        }
Example #2
0
        public static bool IsFileSystem(string value)
        {
            ThrowHelper.ArgumentNull((value == null), nameof(value));

            return(Regex.IsMatch(value, RegexConstant.GetFullRegularExpression(RegularExpression)));
        }