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

◆ GetArrayIndexElement()

JsonElement System.Text.Json.JsonDocument.GetArrayIndexElement ( int currentIndex,
int arrayIndex )
inlinepackage

Definition at line 367 of file JsonDocument.cs.

368 {
370 DbRow dbRow = _parsedData.Get(currentIndex);
371 CheckExpectedType(JsonTokenType.StartArray, dbRow.TokenType);
372 int sizeOrLength = dbRow.SizeOrLength;
373 if ((uint)arrayIndex >= (uint)sizeOrLength)
374 {
375 throw new IndexOutOfRangeException();
376 }
377 if (!dbRow.HasComplexChildren)
378 {
379 return new JsonElement(this, currentIndex + (arrayIndex + 1) * 12);
380 }
381 int num = 0;
382 for (int i = currentIndex + 12; i < _parsedData.Length; i += 12)
383 {
384 if (arrayIndex == num)
385 {
386 return new JsonElement(this, i);
387 }
388 dbRow = _parsedData.Get(i);
389 if (!dbRow.IsSimpleValue)
390 {
391 i += 12 * dbRow.NumberOfRows;
392 }
393 num++;
394 }
395 throw new IndexOutOfRangeException();
396 }
void CheckExpectedType(JsonTokenType expected, JsonTokenType actual)

References System.Text.Json.JsonDocument._parsedData, System.arrayIndex, System.Text.Json.JsonDocument.CheckExpectedType(), System.Text.Json.JsonDocument.CheckNotDisposed(), System.Text.Json.Dictionary, System.Text.Json.JsonDocument.MetadataDb.Get(), and System.Text.Json.JsonDocument.MetadataDb.Length.