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

◆ GetLocalPath()

string System.Uri.GetLocalPath ( )
inlineprivate

Definition at line 899 of file Uri.cs.

900 {
902 if (IsUncOrDosPath)
903 {
905 int num;
906 if (NotAny(Flags.HostNotCanonical | Flags.PathNotCanonical | Flags.ShouldBeCompressed))
907 {
908 num = (IsUncPath ? (_info.Offset.Host - 2) : _info.Offset.Path);
909 string text = ((IsImplicitFile && _info.Offset.Host == ((!IsDosPath) ? 2 : 0) && _info.Offset.Query == _info.Offset.End) ? _string : ((IsDosPath && (_string[num] == '/' || _string[num] == '\\')) ? _string.Substring(num + 1, _info.Offset.Query - num - 1) : _string.Substring(num, _info.Offset.Query - num)));
910 if (IsDosPath && text[1] == '|')
911 {
912 text = text.Remove(1, 1);
913 text = text.Insert(1, ":");
914 }
915 for (int i = 0; i < text.Length; i++)
916 {
917 if (text[i] == '/')
918 {
919 text = text.Replace('/', '\\');
920 break;
921 }
922 }
923 return text;
924 }
925 int destPosition = 0;
926 num = _info.Offset.Path;
927 string host = _info.Host;
928 char[] array = new char[host.Length + 3 + _info.Offset.Fragment - _info.Offset.Path];
929 if (IsUncPath)
930 {
931 array[0] = '\\';
932 array[1] = '\\';
933 destPosition = 2;
934 UriHelper.UnescapeString(host, 0, host.Length, array, ref destPosition, '\uffff', '\uffff', '\uffff', UnescapeMode.CopyOnly, _syntax, isQuery: false);
935 }
936 else if (_string[num] == '/' || _string[num] == '\\')
937 {
938 num++;
939 }
940 ushort num2 = (ushort)destPosition;
941 UnescapeMode unescapeMode = ((InFact(Flags.PathNotCanonical) && !IsImplicitFile) ? (UnescapeMode.Unescape | UnescapeMode.UnescapeAll) : UnescapeMode.CopyOnly);
942 UriHelper.UnescapeString(_string, num, _info.Offset.Query, array, ref destPosition, '\uffff', '\uffff', '\uffff', unescapeMode, _syntax, isQuery: true);
943 if (array[1] == '|')
944 {
945 array[1] = ':';
946 }
947 if (InFact(Flags.ShouldBeCompressed))
948 {
950 }
951 for (ushort num3 = 0; num3 < (ushort)destPosition; num3++)
952 {
953 if (array[num3] == '/')
954 {
955 array[num3] = '\\';
956 }
957 }
958 return new string(array, 0, destPosition);
959 }
960 return GetUnescapedParts(UriComponents.Path | UriComponents.KeepDelimiter, UriFormat.Unescaped);
961 }
string Host
Definition Uri.cs:85
Offset Offset
Definition Uri.cs:81
bool IsUncOrDosPath
Definition Uri.cs:203
UriParser _syntax
Definition Uri.cs:193
void EnsureParseRemaining()
Definition Uri.cs:636
bool IsUncPath
Definition Uri.cs:207
string GetUnescapedParts(UriComponents uriParts, UriFormat formatAs)
Definition Uri.cs:1862
string Query
Definition Uri.cs:477
bool IsDosPath
Definition Uri.cs:205
bool NotAny(Flags flags)
Definition Uri.cs:606
void EnsureHostString(bool allowDnsOptimization)
Definition Uri.cs:644
bool InFact(Flags flags)
Definition Uri.cs:611
string _string
Definition Uri.cs:189
UriInfo _info
Definition Uri.cs:197
bool IsImplicitFile
Definition Uri.cs:201
static void Compress(char[] dest, int start, ref int destLength, UriParser syntax)
Definition Uri.cs:3300
UriFormat
Definition UriFormat.cs:4
ushort Path
Definition Uri.cs:119
ushort Query
Definition Uri.cs:121

References System.Uri._info, System.Uri._string, System.Uri._syntax, System.array, System.Uri.Compress(), System.Runtime.Serialization.Dictionary, System.Uri.Offset.End, System.Uri.EnsureHostString(), System.Uri.EnsureParseRemaining(), System.Uri.GetUnescapedParts(), System.Uri.UriInfo.Host, System.Uri.InFact(), System.Uri.IsDosPath, System.Uri.IsImplicitFile, System.Uri.IsUncOrDosPath, System.Uri.IsUncPath, System.Uri.NotAny(), System.Uri.UriInfo.Offset, System.Uri.Offset.Path, System.Uri.Offset.Query, System.Collections.Generic.Dictionary< TKey, TValue >.Remove(), System.text, and System.UriHelper.UnescapeString().