private void CreateThisFromUri(Uri otherUri)
{
// Clone the other guy but develop own UriInfo member
_info = null;
_flags = otherUri._flags;
if (InFact(Flags.MinimalUriInfoSet))
{
_flags &= ~(Flags.MinimalUriInfoSet | Flags.AllUriInfoSet | Flags.IndexMask);
// Port / Path offset
int portIndex = otherUri._info.Offset.Path;
if (InFact(Flags.NotDefaultPort))
{
// Find the start of the port. Account for non-canonical ports like :00123
while (otherUri._string[portIndex] != ':' && portIndex > otherUri._info.Offset.Host)
{
portIndex--;
}
if (otherUri._string[portIndex] != ':')
{
// Something wrong with the NotDefaultPort flag. Reset to path index
Debug.Assert(false, "Uri failed to locate custom port at index: " + portIndex);
portIndex = otherUri._info.Offset.Path;
}
}
_flags |= (Flags)portIndex; // Port or path
}
_syntax = otherUri._syntax;
_string = otherUri._string;
_iriParsing = otherUri._iriParsing;
if (otherUri.OriginalStringSwitched)
{
_originalUnicodeString = otherUri._originalUnicodeString;
}
if (otherUri.AllowIdn && (otherUri.InFact(Flags.IdnHost) || otherUri.InFact(Flags.UnicodeHost)))
{
_dnsSafeHost = otherUri._dnsSafeHost;
}
}
}