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

◆ TryComputeLength()

override bool System.Net.Http.MultipartContent.TryComputeLength ( out long length)
inlinepackageinherited

Definition at line 535 of file MultipartContent.cs.

536 {
537 long num = 2 + _boundary.Length + 2;
538 if (_nestedContent.Count > 1)
539 {
540 num += (_nestedContent.Count - 1) * (4 + _boundary.Length + 2);
541 }
542 foreach (HttpContent item in _nestedContent)
543 {
544 foreach (KeyValuePair<string, HeaderStringValues> item2 in item.Headers.NonValidated)
545 {
546 num += item2.Key.Length + 2;
547 Encoding encoding = HeaderEncodingSelector?.Invoke(item2.Key, item) ?? HttpRuleParser.DefaultHttpEncoding;
548 int num2 = 0;
549 foreach (string item3 in item2.Value)
550 {
551 num += encoding.GetByteCount(item3);
552 num2++;
553 }
554 if (num2 > 1)
555 {
556 num += (num2 - 1) * 2;
557 }
558 num += 2;
559 }
560 num += 2;
561 if (!item.TryComputeLength(out var length2))
562 {
563 length = 0L;
564 return false;
565 }
566 num += length2;
567 }
568 num += 4 + _boundary.Length + 2 + 2;
569 length = num;
570 return true;
571 }
readonly List< HttpContent > _nestedContent
HeaderEncodingSelector< HttpContent >? HeaderEncodingSelector
virtual int GetByteCount(char[] chars)
Definition Encoding.cs:713

References System.Net.Http.MultipartContent._boundary, System.Net.Http.MultipartContent._nestedContent, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Net.Http.HttpRuleParser.DefaultHttpEncoding, System.Net.Http.MultipartContent.HeaderEncodingSelector, System.item, System.L, System.length, and System.length2.