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

◆ Trim()

void System.Xml.XmlWellFormedWriter.AttributeValueCache.Trim ( )
inlinepackage

Definition at line 487 of file XmlWellFormedWriter.cs.

488 {
489 if (_singleStringValue != null)
490 {
491 _singleStringValue = XmlConvert.TrimString(_singleStringValue);
492 return;
493 }
494 string text = _stringValue.ToString();
495 string text2 = XmlConvert.TrimString(text);
496 if (text != text2)
497 {
499 }
500 int i;
501 for (i = _firstItem; i == _firstItem && i <= _lastItem; i++)
502 {
503 Item item = _items[i];
504 switch (item.type)
505 {
506 case ItemType.Whitespace:
507 _firstItem++;
508 break;
509 case ItemType.String:
510 case ItemType.Raw:
511 case ItemType.ValueString:
512 item.data = XmlConvert.TrimStringStart((string)item.data);
513 if (((string)item.data).Length == 0)
514 {
515 _firstItem++;
516 }
517 break;
518 case ItemType.StringChars:
519 case ItemType.RawChars:
520 {
521 BufferChunk bufferChunk = (BufferChunk)item.data;
522 int num = bufferChunk.index + bufferChunk.count;
523 while (bufferChunk.index < num && XmlCharType.IsWhiteSpace(bufferChunk.buffer[bufferChunk.index]))
524 {
525 bufferChunk.index++;
526 bufferChunk.count--;
527 }
528 if (bufferChunk.index == num)
529 {
530 _firstItem++;
531 }
532 break;
533 }
534 }
535 }
536 i = _lastItem;
537 while (i == _lastItem && i >= _firstItem)
538 {
539 Item item2 = _items[i];
540 switch (item2.type)
541 {
542 case ItemType.Whitespace:
543 _lastItem--;
544 break;
545 case ItemType.String:
546 case ItemType.Raw:
547 case ItemType.ValueString:
548 item2.data = XmlConvert.TrimStringEnd((string)item2.data);
549 if (((string)item2.data).Length == 0)
550 {
551 _lastItem--;
552 }
553 break;
554 case ItemType.StringChars:
555 case ItemType.RawChars:
556 {
557 BufferChunk bufferChunk2 = (BufferChunk)item2.data;
558 while (bufferChunk2.count > 0 && XmlCharType.IsWhiteSpace(bufferChunk2.buffer[bufferChunk2.index + bufferChunk2.count - 1]))
559 {
560 bufferChunk2.count--;
561 }
562 if (bufferChunk2.count == 0)
563 {
564 _lastItem--;
565 }
566 break;
567 }
568 }
569 i--;
570 }
571 }
override string ToString()

References System.Xml.XmlWellFormedWriter.AttributeValueCache._firstItem, System.Xml.XmlWellFormedWriter.AttributeValueCache._items, System.Xml.XmlWellFormedWriter.AttributeValueCache._lastItem, System.Xml.XmlWellFormedWriter.AttributeValueCache._singleStringValue, System.Xml.XmlWellFormedWriter.AttributeValueCache._stringValue, System.Xml.Dictionary, System.Xml.XmlCharType.IsWhiteSpace(), System.item, System.text, System.Text.StringBuilder.ToString(), System.Xml.XmlConvert.TrimString(), System.Xml.XmlConvert.TrimStringEnd(), and System.Xml.XmlConvert.TrimStringStart().

Referenced by System.Xml.XmlWellFormedWriter.WriteEndAttribute(), and System.Xml.XmlWellFormedWriter.WriteEndAttributeAsync_SepcialAtt().