示例#1
0
        public static string GetFullUrl(string text, string sourceFilename)
        {
            if (string.IsNullOrEmpty(text))
            {
                return(null);
            }

            text = text.Trim(new[] { '\'', '"', '~' });

            if (text.StartsWith("//", StringComparison.Ordinal))
            {
                text = "http:" + text;
            }

            if (text.Contains("://") || text.StartsWith("data:", StringComparison.Ordinal))
            {
                return(text);
            }

            if (string.IsNullOrEmpty(sourceFilename))
            {
                return(null);
            }

            text = Uri.UnescapeDataString(text);
            return(ProjectHelpers.ToAbsoluteFilePath(text, sourceFilename));
        }