Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ResolveHelper()

static Uri System.Uri.ResolveHelper ( Uri baseUri,
Uri relativeUri,
ref string newUriString,
ref bool userEscaped )
inlinestaticpackage

Definition at line 4149 of file Uri.cs.

4150 {
4151 string text;
4152 if ((object)relativeUri != null)
4153 {
4154 if (relativeUri.IsAbsoluteUri)
4155 {
4156 return relativeUri;
4157 }
4158 text = relativeUri.OriginalString;
4159 userEscaped = relativeUri.UserEscaped;
4160 }
4161 else
4162 {
4163 text = string.Empty;
4164 }
4165 if (text.Length > 0 && (UriHelper.IsLWS(text[0]) || UriHelper.IsLWS(text[text.Length - 1])))
4166 {
4167 text = text.Trim(UriHelper.s_WSchars);
4168 }
4169 if (text.Length == 0)
4170 {
4171 newUriString = baseUri.GetParts(UriComponents.AbsoluteUri, baseUri.UserEscaped ? UriFormat.UriEscaped : UriFormat.SafeUnescaped);
4172 return null;
4173 }
4174 if (text[0] == '#' && !baseUri.IsImplicitFile && baseUri.Syntax.InFact(UriSyntaxFlags.MayHaveFragment))
4175 {
4176 newUriString = baseUri.GetParts(UriComponents.HttpRequestUrl | UriComponents.UserInfo, UriFormat.UriEscaped) + text;
4177 return null;
4178 }
4179 if (text[0] == '?' && !baseUri.IsImplicitFile && baseUri.Syntax.InFact(UriSyntaxFlags.MayHaveQuery))
4180 {
4181 newUriString = baseUri.GetParts(UriComponents.SchemeAndServer | UriComponents.UserInfo | UriComponents.Path, UriFormat.UriEscaped) + text;
4182 return null;
4183 }
4184 if (text.Length >= 3 && (text[1] == ':' || text[1] == '|') && UriHelper.IsAsciiLetter(text[0]) && (text[2] == '\\' || text[2] == '/'))
4185 {
4186 if (baseUri.IsImplicitFile)
4187 {
4189 return null;
4190 }
4191 if (baseUri.Syntax.InFact(UriSyntaxFlags.AllowDOSPath))
4192 {
4193 newUriString = string.Concat(str1: (!baseUri.InFact(Flags.AuthorityFound)) ? (baseUri.Syntax.InFact(UriSyntaxFlags.PathIsRooted) ? ":/" : ":") : (baseUri.Syntax.InFact(UriSyntaxFlags.PathIsRooted) ? ":///" : "://"), str0: baseUri.Scheme, str2: text);
4194 return null;
4195 }
4196 }
4198 if ((object)newUriString == baseUri._string)
4199 {
4200 return baseUri;
4201 }
4202 return null;
4203 }
UriParser Syntax
Definition Uri.cs:211
static void GetCombinedString(Uri baseUri, string relativeStr, bool dontEscape, ref string result)
Definition Uri.cs:839
bool InFact(Flags flags)
Definition Uri.cs:611
string Scheme
Definition Uri.cs:505
UriFormat
Definition UriFormat.cs:4

References System.Uri._string, System.Runtime.Serialization.Dictionary, System.Uri.GetCombinedString(), System.Uri.GetParts(), System.Uri.InFact(), System.UriParser.InFact(), System.UriHelper.IsAsciiLetter(), System.Uri.IsImplicitFile, System.UriHelper.IsLWS(), System.UriHelper.s_WSchars, System.Uri.Scheme, System.Uri.Syntax, System.text, and System.Uri.UserEscaped.

Referenced by System.Uri.Uri(), System.Uri.CreateUri(), System.Uri.IsBaseOfHelper(), System.UriParser.Resolve(), and System.Uri.TryCreate().