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

◆ PathDifference()

static string System.Uri.PathDifference ( string path1,
string path2,
bool compareCase )
inlinestaticprivate

Definition at line 3498 of file Uri.cs.

3499 {
3500 int num = -1;
3501 int i;
3502 for (i = 0; i < path1.Length && i < path2.Length && (path1[i] == path2[i] || (!compareCase && char.ToLowerInvariant(path1[i]) == char.ToLowerInvariant(path2[i]))); i++)
3503 {
3504 if (path1[i] == '/')
3505 {
3506 num = i;
3507 }
3508 }
3509 if (i == 0)
3510 {
3511 return path2;
3512 }
3513 if (i == path1.Length && i == path2.Length)
3514 {
3515 return string.Empty;
3516 }
3518 for (; i < path1.Length; i++)
3519 {
3520 if (path1[i] == '/')
3521 {
3522 stringBuilder.Append("../");
3523 }
3524 }
3525 if (stringBuilder.Length == 0 && path2.Length - 1 == num)
3526 {
3527 return "./";
3528 }
3529 return stringBuilder.Append(path2.AsSpan(num + 1)).ToString();
3530 }

References System.Runtime.Serialization.Dictionary.

Referenced by System.Uri.MakeRelative(), and System.Uri.MakeRelativeUri().