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

◆ Ipv6StringToAddress()

static unsafe bool System.Net.IPAddressParser.Ipv6StringToAddress ( ReadOnlySpan< char > ipSpan,
Span< ushort > numbers,
int numbersLength,
out uint scope )
inlinestatic

Definition at line 149 of file IPAddressParser.cs.

150 {
151 int end = ipSpan.Length;
152 bool flag = false;
153 fixed (char* name = &MemoryMarshal.GetReference(ipSpan))
154 {
155 flag = System.IPv6AddressHelper.IsValidStrict(name, 0, ref end);
156 }
157 if (flag || end != ipSpan.Length)
158 {
159 string scopeId = null;
160 System.IPv6AddressHelper.Parse(ipSpan, numbers, 0, ref scopeId);
161 if (scopeId != null && scopeId.Length > 1)
162 {
163 if (uint.TryParse(scopeId.AsSpan(1), NumberStyles.None, CultureInfo.InvariantCulture, out scope))
164 {
165 return true;
166 }
167 uint num = InterfaceInfoPal.InterfaceNameToIndex(scopeId);
168 if (num != 0)
169 {
170 scope = num;
171 return true;
172 }
173 }
174 scope = 0u;
175 return true;
176 }
177 scope = 0u;
178 return false;
179 }
static CultureInfo InvariantCulture
static unsafe bool IsValidStrict(char *name, int start, ref int end)
static void Parse(ReadOnlySpan< char > address, Span< ushort > numbers, int start, ref string scopeId)
static uint InterfaceNameToIndex(string interfaceName)

References System.Net.NetworkInformation.InterfaceInfoPal.InterfaceNameToIndex(), System.Globalization.CultureInfo.InvariantCulture, System.IPv6AddressHelper.IsValidStrict(), System.ReadOnlySpan< T >.Length, and System.IPv6AddressHelper.Parse().

Referenced by System.Net.IPAddressParser.Parse().