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

◆ TryParseExactN()

static bool System.Guid.TryParseExactN ( ReadOnlySpan< char > guidString,
ref GuidResult result )
inlinestaticprivate

Definition at line 409 of file Guid.cs.

410 {
411 if (guidString.Length != 32)
412 {
413 result.SetFailure(overflow: false, "Format_GuidInvLen");
414 return false;
415 }
416 Span<byte> span = MemoryMarshal.AsBytes(new Span<GuidResult>(ref result, 1));
417 int invalidIfNegative = 0;
418 span[0] = DecodeByte(guidString[6], guidString[7], ref invalidIfNegative);
419 span[1] = DecodeByte(guidString[4], guidString[5], ref invalidIfNegative);
420 span[2] = DecodeByte(guidString[2], guidString[3], ref invalidIfNegative);
421 span[3] = DecodeByte(guidString[0], guidString[1], ref invalidIfNegative);
422 span[4] = DecodeByte(guidString[10], guidString[11], ref invalidIfNegative);
423 span[5] = DecodeByte(guidString[8], guidString[9], ref invalidIfNegative);
424 span[6] = DecodeByte(guidString[14], guidString[15], ref invalidIfNegative);
425 span[7] = DecodeByte(guidString[12], guidString[13], ref invalidIfNegative);
426 span[8] = DecodeByte(guidString[16], guidString[17], ref invalidIfNegative);
427 span[9] = DecodeByte(guidString[18], guidString[19], ref invalidIfNegative);
428 span[10] = DecodeByte(guidString[20], guidString[21], ref invalidIfNegative);
429 span[11] = DecodeByte(guidString[22], guidString[23], ref invalidIfNegative);
430 span[12] = DecodeByte(guidString[24], guidString[25], ref invalidIfNegative);
431 span[13] = DecodeByte(guidString[26], guidString[27], ref invalidIfNegative);
432 span[14] = DecodeByte(guidString[28], guidString[29], ref invalidIfNegative);
433 span[15] = DecodeByte(guidString[30], guidString[31], ref invalidIfNegative);
434 if (invalidIfNegative >= 0)
435 {
436 if (!BitConverter.IsLittleEndian)
437 {
438 }
439 return true;
440 }
441 result.SetFailure(overflow: false, "Format_GuidInvalidChar");
442 return false;
443 }
static byte DecodeByte(nuint ch1, nuint ch2, ref int invalidIfNegative)
Definition Guid.cs:568

References System.Guid.DecodeByte(), System.BitConverter.IsLittleEndian, and System.ReadOnlySpan< T >.Length.

Referenced by System.Guid.ParseExact(), System.Guid.TryParseExact(), and System.Guid.TryParseGuid().