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

◆ CreateUriInfo()

unsafe void System.Uri.CreateUriInfo ( Flags cF)
inlineprivate

Definition at line 1490 of file Uri.cs.

1491 {
1492 UriInfo uriInfo = new UriInfo();
1493 uriInfo.Offset.End = (ushort)_string.Length;
1494 if (!UserDrivenParsing)
1495 {
1496 bool flag = false;
1497 int i;
1498 if ((cF & Flags.ImplicitFile) != Flags.Zero)
1499 {
1500 i = 0;
1501 while (UriHelper.IsLWS(_string[i]))
1502 {
1503 i++;
1504 uriInfo.Offset.Scheme++;
1505 }
1506 if (StaticInFact(cF, Flags.UncPath))
1507 {
1508 i += 2;
1509 for (int num = (int)(cF & Flags.IndexMask); i < num && (_string[i] == '/' || _string[i] == '\\'); i++)
1510 {
1511 }
1512 }
1513 }
1514 else
1515 {
1516 i = _syntax.SchemeName.Length;
1517 while (_string[i++] != ':')
1518 {
1519 uriInfo.Offset.Scheme++;
1520 }
1521 if ((cF & Flags.AuthorityFound) != Flags.Zero)
1522 {
1523 if (_string[i] == '\\' || _string[i + 1] == '\\')
1524 {
1525 flag = true;
1526 }
1527 i += 2;
1528 if ((cF & (Flags.DosPath | Flags.UncPath)) != Flags.Zero)
1529 {
1530 for (int num2 = (int)(cF & Flags.IndexMask); i < num2 && (_string[i] == '/' || _string[i] == '\\'); i++)
1531 {
1532 flag = true;
1533 }
1534 }
1535 }
1536 }
1537 if (_syntax.DefaultPort != -1)
1538 {
1540 }
1541 if ((cF & Flags.HostTypeMask) == Flags.HostTypeMask || StaticInFact(cF, Flags.DosPath))
1542 {
1543 uriInfo.Offset.User = (ushort)(cF & Flags.IndexMask);
1544 uriInfo.Offset.Host = uriInfo.Offset.User;
1545 uriInfo.Offset.Path = uriInfo.Offset.User;
1546 cF = (Flags)((ulong)cF & 0xFFFFFFFFFFFF0000uL);
1547 if (flag)
1548 {
1549 cF |= Flags.SchemeNotCanonical;
1550 }
1551 }
1552 else
1553 {
1554 uriInfo.Offset.User = (ushort)i;
1555 if (HostType == Flags.BasicHostType)
1556 {
1557 uriInfo.Offset.Host = (ushort)i;
1558 uriInfo.Offset.Path = (ushort)(cF & Flags.IndexMask);
1559 cF = (Flags)((ulong)cF & 0xFFFFFFFFFFFF0000uL);
1560 }
1561 else
1562 {
1563 if ((cF & Flags.HasUserInfo) != Flags.Zero)
1564 {
1565 for (; _string[i] != '@'; i++)
1566 {
1567 }
1568 i++;
1569 uriInfo.Offset.Host = (ushort)i;
1570 }
1571 else
1572 {
1573 uriInfo.Offset.Host = (ushort)i;
1574 }
1575 i = (int)(cF & Flags.IndexMask);
1576 cF = (Flags)((ulong)cF & 0xFFFFFFFFFFFF0000uL);
1577 if (flag)
1578 {
1579 cF |= Flags.SchemeNotCanonical;
1580 }
1581 uriInfo.Offset.Path = (ushort)i;
1582 bool flag2 = false;
1583 if ((cF & Flags.HasUnicode) != Flags.Zero)
1584 {
1586 }
1587 if (i < uriInfo.Offset.End)
1588 {
1589 fixed (char* ptr = OriginalString)
1590 {
1591 if (ptr[i] == ':')
1592 {
1593 int num3 = 0;
1594 if (++i < uriInfo.Offset.End)
1595 {
1596 num3 = ptr[i] - 48;
1597 if ((uint)num3 <= 9u)
1598 {
1599 flag2 = true;
1600 if (num3 == 0)
1601 {
1602 cF |= Flags.PortNotCanonical | Flags.E_PortNotCanonical;
1603 }
1604 for (i++; i < uriInfo.Offset.End; i++)
1605 {
1606 int num4 = ptr[i] - 48;
1607 if ((uint)num4 > 9u)
1608 {
1609 break;
1610 }
1611 num3 = num3 * 10 + num4;
1612 }
1613 }
1614 }
1615 if (flag2 && _syntax.DefaultPort != num3)
1616 {
1618 cF |= Flags.NotDefaultPort;
1619 }
1620 else
1621 {
1622 cF |= Flags.PortNotCanonical | Flags.E_PortNotCanonical;
1623 }
1624 uriInfo.Offset.Path = (ushort)i;
1625 }
1626 }
1627 }
1628 }
1629 }
1630 }
1631 cF |= Flags.MinimalUriInfoSet;
1633 Flags flags = _flags;
1634 while ((flags & Flags.MinimalUriInfoSet) == Flags.Zero)
1635 {
1636 Flags value = (Flags)(((ulong)flags & 0xFFFFFFFFFFFF0000uL) | (ulong)cF);
1637 ulong num5 = Interlocked.CompareExchange(ref Internal.Runtime.CompilerServices.Unsafe.As<Flags, ulong>(ref _flags), (ulong)value, (ulong)flags);
1638 if (num5 == (ulong)flags)
1639 {
1640 break;
1641 }
1642 flags = (Flags)num5;
1643 }
1644 }
static int CompareExchange(ref int location1, int value, int comparand)
string SchemeName
Definition UriParser.cs:81
UriParser _syntax
Definition Uri.cs:193
bool UserDrivenParsing
Definition Uri.cs:219
string _originalUnicodeString
Definition Uri.cs:191
Flags _flags
Definition Uri.cs:195
string OriginalString
Definition Uri.cs:516
static bool StaticInFact(Flags allFlags, Flags checkFlags)
Definition Uri.cs:621
string _string
Definition Uri.cs:189
Flags HostType
Definition Uri.cs:209
UriInfo _info
Definition Uri.cs:197

References System.Uri._flags, System.Uri._info, System.Uri._originalUnicodeString, System.Uri._string, System.Uri._syntax, System.Threading.Interlocked.CompareExchange(), System.UriParser.DefaultPort, System.Runtime.Serialization.Dictionary, System.Uri.HostType, System.UriHelper.IsLWS(), System.Uri.OriginalString, System.UriParser.SchemeName, System.Uri.StaticInFact(), System.Uri.UserDrivenParsing, and System.value.

Referenced by System.Uri.EnsureUriInfo().