Esempio n. 1
0
        public ParsedUrlPath ParsePath(string input)
        {
            var result = new ParsedUrlPath();

            var parts = input.Split(new[] { '.' });

            if (parts.Length < 3)
            {
                //invalid
                return(null);
            }

            if (!parts[parts.Length - 1].StartsWith("v"))
            {
                //invalid
                return(null);
            }

            result.Version = parts[parts.Length - 1].Substring(1);
            var         ext = parts[parts.Length - 2];
            WebFileType type;

            if (!Enum.TryParse(ext, true, out type))
            {
                //invalid
                return(null);
            }
            result.WebType = type;

            result.Names = parts.Take(parts.Length - 2);

            return(result);
        }
Esempio n. 2
0
        public ParsedUrlPath ParsePath(string input)
        {
            var result = new ParsedUrlPath();

            var parts = input.Split(new[] { '.' });

            if (parts.Length < 3)
            {
                //invalid
                return(null);
            }

            //can start with 'v' or 'd' (d == debug)
            var prefix = parts[parts.Length - 1][0];

            if (prefix != 'v' && prefix != 'd')
            {
                //invalid
                return(null);
            }
            result.Debug = prefix == 'd';

            result.Version = parts[parts.Length - 1].Substring(1);
            var         ext = parts[parts.Length - 2];
            WebFileType type;

            if (!Enum.TryParse(ext, true, out type))
            {
                //invalid
                return(null);
            }
            result.WebType = type;

            result.Names = parts.Take(parts.Length - 2);

            return(result);
        }
Esempio n. 3
0
        public ParsedUrlPath ParsePath(string input)
        {
            var result = new ParsedUrlPath();

            var parts = input.Split(new[] { '.' });

            if (parts.Length < 3)
            {
                //invalid
                return null;
            }

            if (!parts[parts.Length - 1].StartsWith("v"))
            {
                //invalid
                return null;
            }

            result.Version = parts[parts.Length - 1].Substring(1);
            var ext = parts[parts.Length - 2];
            WebFileType type;
            if (!Enum.TryParse(ext, true, out type))
            {
                //invalid
                return null;
            }
            result.WebType = type;

            result.Names = parts.Take(parts.Length - 2);

            return result;
        }