You are on page 1of 65

using System;

using System.Diagnostics;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security;

namespace System.Text
{
/// <summary>Represents a mutable string of characters. This class cannot be inherited.To browse th
e .NET Framework source code for this type, see the Reference Source.</summary>
// Token: 0x02000A29 RID: 2601
[ComVisible(true)]
[__DynamicallyInvokable]
[Serializable]
public sealed class StringBuilder : ISerializable
{
/// <summary>Initializes a new instance of the <see cref="T:System.Text.StringBuilder" /> class.</su
mmary>
// Token: 0x0600657E RID: 25982 RVA: 0x001544E0 File Offset: 0x001526E0
[__DynamicallyInvokable]
public StringBuilder() : this(16)
{
}

/// <summary>Initializes a new instance of the <see cref="T:System.Text.StringBuilder" /> class usin
g the specified capacity.</summary>
/// <param name="capacity">The suggested starting size of this instance. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="capacity" /> is less than zero. </exception>
// Token: 0x0600657F RID: 25983 RVA: 0x001544EA File Offset: 0x001526EA
[__DynamicallyInvokable]
public StringBuilder(int capacity) : this(string.Empty, capacity)
{
}

/// <summary>Initializes a new instance of the <see cref="T:System.Text.StringBuilder" /> class usin
g the specified string.</summary>
/// <param name="value">The string used to initialize the value of the instance. If <paramref name
="value" /> is null, the new <see cref="T:System.Text.StringBuilder" /> will contain the empty string (tha
t is, it contains <see cref="F:System.String.Empty" />). </param>
// Token: 0x06006580 RID: 25984 RVA: 0x001544F8 File Offset: 0x001526F8
[__DynamicallyInvokable]
public StringBuilder(string value) : this(value, 16)
{
}

/// <summary>Initializes a new instance of the <see cref="T:System.Text.StringBuilder" /> class usin
g the specified string and capacity.</summary>
/// <param name="value">The string used to initialize the value of the instance. If <paramref name
="value" /> is null, the new <see cref="T:System.Text.StringBuilder" /> will contain the empty string (tha
t is, it contains <see cref="F:System.String.Empty" />). </param>
/// <param name="capacity">The suggested starting size of the <see cref="T:System.Text.StringBuil
der" />. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="capacity" /> is less than zero. </exception>
// Token: 0x06006581 RID: 25985 RVA: 0x00154503 File Offset: 0x00152703
[__DynamicallyInvokable]
public StringBuilder(string value, int capacity) : this(value, 0, (value != null) ? value.Length : 0, capac
ity)
{
}

/// <summary>Initializes a new instance of the <see cref="T:System.Text.StringBuilder" /> class fro
m the specified substring and capacity.</summary>
/// <param name="value">The string that contains the substring used to initialize the value of this i
nstance. If <paramref name="value" /> is null, the new <see cref="T:System.Text.StringBuilder" /> will c
ontain the empty string (that is, it contains <see cref="F:System.String.Empty" />). </param>
/// <param name="startIndex">The position within <paramref name="value" /> where the substrin
g begins. </param>
/// <param name="length">The number of characters in the substring. </param>
/// <param name="capacity">The suggested starting size of the <see cref="T:System.Text.StringBuil
der" />. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="capacity" /> is less than zero.-
or- <paramref name="startIndex" /> plus <paramref name="length" /> is not a position within <paramre
f name="value" />. </exception>
// Token: 0x06006582 RID: 25986 RVA: 0x0015451C File Offset: 0x0015271C
[SecuritySafeCritical]
[__DynamicallyInvokable]
public unsafe StringBuilder(string value, int startIndex, int length, int capacity)
{
if (capacity < 0)
{
throw new ArgumentOutOfRangeException("capacity", Environment.GetResourceString("Argu
mentOutOfRange_MustBePositive", new object[]
{
"capacity"
}));
}
if (length < 0)
{
throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("Argume
ntOutOfRange_MustBeNonNegNum", new object[]
{
"length"
}));
}
if (startIndex < 0)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("Arg
umentOutOfRange_StartIndex"));
}
if (value == null)
{
value = string.Empty;
}
if (startIndex > value.Length - length)
{
throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("Argume
ntOutOfRange_IndexLength"));
}
this.m_MaxCapacity = int.MaxValue;
if (capacity == 0)
{
capacity = 16;
}
if (capacity < length)
{
capacity = length;
}
this.m_ChunkChars = new char[capacity];
this.m_ChunkLength = length;
fixed (string text = value)
{
char* ptr = text;
if (ptr != null)
{
ptr += RuntimeHelpers.OffsetToStringData / 2;
}
StringBuilder.ThreadSafeCopy(ptr + startIndex, this.m_ChunkChars, 0, length);
}
}

/// <summary>Initializes a new instance of the <see cref="T:System.Text.StringBuilder" /> class that
starts with a specified capacity and can grow to a specified maximum.</summary>
/// <param name="capacity">The suggested starting size of the <see cref="T:System.Text.StringBuil
der" />. </param>
/// <param name="maxCapacity">The maximum number of characters the current string can contai
n. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="maxCapacity" /> is less than one, <paramref name="capacity" /> is less than
zero, or <paramref name="capacity" /> is greater than <paramref name="maxCapacity" />. </exception>
// Token: 0x06006583 RID: 25987 RVA: 0x00154618 File Offset: 0x00152818
[__DynamicallyInvokable]
public StringBuilder(int capacity, int maxCapacity)
{
if (capacity > maxCapacity)
{
throw new ArgumentOutOfRangeException("capacity", Environment.GetResourceString("Argu
mentOutOfRange_Capacity"));
}
if (maxCapacity < 1)
{
throw new ArgumentOutOfRangeException("maxCapacity", Environment.GetResourceString("A
rgumentOutOfRange_SmallMaxCapacity"));
}
if (capacity < 0)
{
throw new ArgumentOutOfRangeException("capacity", Environment.GetResourceString("Argu
mentOutOfRange_MustBePositive", new object[]
{
"capacity"
}));
}
if (capacity == 0)
{
capacity = Math.Min(16, maxCapacity);
}
this.m_MaxCapacity = maxCapacity;
this.m_ChunkChars = new char[capacity];
}

// Token: 0x06006584 RID: 25988 RVA: 0x001546A4 File Offset: 0x001528A4


[SecurityCritical]
private StringBuilder(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
int num = 0;
string text = null;
int num2 = int.MaxValue;
bool flag = false;
SerializationInfoEnumerator enumerator = info.GetEnumerator();
while (enumerator.MoveNext())
{
string name = enumerator.Name;
if (!(name == "m_MaxCapacity"))
{
if (!(name == "m_StringValue"))
{
if (name == "Capacity")
{
num = info.GetInt32("Capacity");
flag = true;
}
}
else
{
text = info.GetString("m_StringValue");
}
}
else
{
num2 = info.GetInt32("m_MaxCapacity");
}
}
if (text == null)
{
text = string.Empty;
}
if (num2 < 1 || text.Length > num2)
{
throw new SerializationException(Environment.GetResourceString("Serialization_StringBuilder
MaxCapacity"));
}
if (!flag)
{
num = 16;
if (num < text.Length)
{
num = text.Length;
}
if (num > num2)
{
num = num2;
}
}
if (num < 0 || num < text.Length || num > num2)
{
throw new SerializationException(Environment.GetResourceString("Serialization_StringBuilder
Capacity"));
}
this.m_MaxCapacity = num2;
this.m_ChunkChars = new char[num];
text.CopyTo(0, this.m_ChunkChars, 0, text.Length);
this.m_ChunkLength = text.Length;
this.m_ChunkPrevious = null;
}

/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object wi


th the data necessary to deserialize the current <see cref="T:System.Text.StringBuilder" /> object.</sum
mary>
/// <param name="info">The object to populate with serialization information.</param>
/// <param name="context">The place to store and retrieve serialized data. Reserved for future use
.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="info" /> is null. </exception>
// Token: 0x06006585 RID: 25989 RVA: 0x001547E0 File Offset: 0x001529E0
[SecurityCritical]
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
info.AddValue("m_MaxCapacity", this.m_MaxCapacity);
info.AddValue("Capacity", this.Capacity);
info.AddValue("m_StringValue", this.ToString());
info.AddValue("m_currentThread", 0);
}
// Token: 0x06006586 RID: 25990 RVA: 0x0015483C File Offset: 0x00152A3C
[Conditional("_DEBUG")]
private void VerifyClassInvariant()
{
StringBuilder stringBuilder = this;
int maxCapacity = this.m_MaxCapacity;
for (;;)
{
StringBuilder chunkPrevious = stringBuilder.m_ChunkPrevious;
if (chunkPrevious == null)
{
break;
}
stringBuilder = chunkPrevious;
}
}

/// <summary>Gets or sets the maximum number of characters that can be contained in the memor
y allocated by the current instance.</summary>
/// <returns>The maximum number of characters that can be contained in the memory allocated by
the current instance. Its value can range from <see cref="P:System.Text.StringBuilder.Length" /> to <see
cref="P:System.Text.StringBuilder.MaxCapacity" />. </returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified for a set opera
tion is less than the current length of this instance.-
or- The value specified for a set operation is greater than the maximum capacity. </exception>
// Token: 0x17001172 RID: 4466
// (get) Token: 0x06006587 RID: 25991 RVA: 0x00154860 File Offset: 0x00152A60
// (set) Token: 0x06006588 RID: 25992 RVA: 0x00154874 File Offset: 0x00152A74
[__DynamicallyInvokable]
public int Capacity
{
[__DynamicallyInvokable]
get
{
return this.m_ChunkChars.Length + this.m_ChunkOffset;
}
[__DynamicallyInvokable]
set
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value", Environment.GetResourceString("Argum
entOutOfRange_NegativeCapacity"));
}
if (value > this.MaxCapacity)
{
throw new ArgumentOutOfRangeException("value", Environment.GetResourceString("Argum
entOutOfRange_Capacity"));
}
if (value < this.Length)
{
throw new ArgumentOutOfRangeException("value", Environment.GetResourceString("Argum
entOutOfRange_SmallCapacity"));
}
if (this.Capacity != value)
{
int num = value - this.m_ChunkOffset;
char[] array = new char[num];
Array.Copy(this.m_ChunkChars, array, this.m_ChunkLength);
this.m_ChunkChars = array;
}
}
}

/// <summary>Gets the maximum capacity of this instance.</summary>


/// <returns>The maximum number of characters this instance can hold.</returns>
// Token: 0x17001173 RID: 4467
// (get) Token: 0x06006589 RID: 25993 RVA: 0x00154908 File Offset: 0x00152B08
[__DynamicallyInvokable]
public int MaxCapacity
{
[__DynamicallyInvokable]
get
{
return this.m_MaxCapacity;
}
}

/// <summary>Ensures that the capacity of this instance of <see cref="T:System.Text.StringBuilder"


/> is at least the specified value.</summary>
/// <param name="capacity">The minimum capacity to ensure. </param>
/// <returns>The new capacity of this instance.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="capacity" /> is less than zero.-
or- Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacit
y" />. </exception>
// Token: 0x0600658A RID: 25994 RVA: 0x00154910 File Offset: 0x00152B10
[__DynamicallyInvokable]
public int EnsureCapacity(int capacity)
{
if (capacity < 0)
{
throw new ArgumentOutOfRangeException("capacity", Environment.GetResourceString("Argu
mentOutOfRange_NegativeCapacity"));
}
if (this.Capacity < capacity)
{
this.Capacity = capacity;
}
return this.Capacity;
}

/// <summary>Converts the value of this instance to a <see cref="T:System.String" />.</summary>


/// <returns>A string whose value is the same as this instance.</returns>
// Token: 0x0600658B RID: 25995 RVA: 0x00154944 File Offset: 0x00152B44
[SecuritySafeCritical]
[__DynamicallyInvokable]
public unsafe override string ToString()
{
if (this.Length == 0)
{
return string.Empty;
}
string text = string.FastAllocateString(this.Length);
StringBuilder stringBuilder = this;
fixed (string text2 = text)
{
char* ptr = text2;
if (ptr != null)
{
ptr += RuntimeHelpers.OffsetToStringData / 2;
}
for (;;)
{
if (stringBuilder.m_ChunkLength > 0)
{
char[] chunkChars = stringBuilder.m_ChunkChars;
int chunkOffset = stringBuilder.m_ChunkOffset;
int chunkLength = stringBuilder.m_ChunkLength;
if ((ulong)(chunkLength + chunkOffset) > (ulong)((long)text.Length) || chunkLength > chunk
Chars.Length)
{
break;
}
fixed (char* ptr2 = chunkChars)
{
string.wstrcpy(ptr + chunkOffset, ptr2, chunkLength);
}
}
stringBuilder = stringBuilder.m_ChunkPrevious;
if (stringBuilder == null)
{
goto Block_7;
}
}
throw new ArgumentOutOfRangeException("chunkLength", Environment.GetResourceString("A
rgumentOutOfRange_Index"));
Block_7:;
}
return text;
}

/// <summary>Converts the value of a substring of this instance to a <see cref="T:System.String" />.
</summary>
/// <param name="startIndex">The starting position of the substring in this instance. </param>
/// <param name="length">The length of the substring. </param>
/// <returns>A string whose value is the same as the specified substring of this instance.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="startIndex" /> or <paramref name="length" /> is less than zero.-
or- The sum of <paramref name="startIndex" /> and <paramref name="length" /> is greater than the len
gth of the current instance. </exception>
// Token: 0x0600658C RID: 25996 RVA: 0x00154A10 File Offset: 0x00152C10
[SecuritySafeCritical]
[__DynamicallyInvokable]
public unsafe string ToString(int startIndex, int length)
{
int length2 = this.Length;
if (startIndex < 0)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("Arg
umentOutOfRange_StartIndex"));
}
if (startIndex > length2)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("Arg
umentOutOfRange_StartIndexLargerThanLength"));
}
if (length < 0)
{
throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("Argume
ntOutOfRange_NegativeLength"));
}
if (startIndex > length2 - length)
{
throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("Argume
ntOutOfRange_IndexLength"));
}
StringBuilder stringBuilder = this;
int num = startIndex + length;
string text = string.FastAllocateString(length);
int i = length;
fixed (string text2 = text)
{
char* ptr = text2;
if (ptr != null)
{
ptr += RuntimeHelpers.OffsetToStringData / 2;
}
while (i > 0)
{
int num2 = num - stringBuilder.m_ChunkOffset;
if (num2 >= 0)
{
if (num2 > stringBuilder.m_ChunkLength)
{
num2 = stringBuilder.m_ChunkLength;
}
int num3 = i;
int num4 = num3;
int num5 = num2 - num3;
if (num5 < 0)
{
num4 += num5;
num5 = 0;
}
i -= num4;
if (num4 > 0)
{
char[] chunkChars = stringBuilder.m_ChunkChars;
if ((ulong)(num4 + i) > (ulong)((long)length) || num4 + num5 > chunkChars.Length)
{
throw new ArgumentOutOfRangeException("chunkCount", Environment.GetResource
String("ArgumentOutOfRange_Index"));
}
fixed (char* ptr2 = &chunkChars[num5])
{
string.wstrcpy(ptr + i, ptr2, num4);
}
}
}
stringBuilder = stringBuilder.m_ChunkPrevious;
}
}
return text;
}

/// <summary>Removes all characters from the current <see cref="T:System.Text.StringBuilder" /> i
nstance.</summary>
/// <returns>An object whose <see cref="P:System.Text.StringBuilder.Length" /> is 0 (zero).</return
s>
// Token: 0x0600658D RID: 25997 RVA: 0x00154B6E File Offset: 0x00152D6E
[__DynamicallyInvokable]
public StringBuilder Clear()
{
this.Length = 0;
return this;
}

/// <summary>Gets or sets the length of the current <see cref="T:System.Text.StringBuilder" /> obj
ect.</summary>
/// <returns>The length of this instance.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified for a set opera
tion is less than zero or greater than <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </excepti
on>
// Token: 0x17001174 RID: 4468
// (get) Token: 0x0600658E RID: 25998 RVA: 0x00154B78 File Offset: 0x00152D78
// (set) Token: 0x0600658F RID: 25999 RVA: 0x00154B88 File Offset: 0x00152D88
[__DynamicallyInvokable]
public int Length
{
[__DynamicallyInvokable]
get
{
return this.m_ChunkOffset + this.m_ChunkLength;
}
[__DynamicallyInvokable]
set
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value", Environment.GetResourceString("Argum
entOutOfRange_NegativeLength"));
}
if (value > this.MaxCapacity)
{
throw new ArgumentOutOfRangeException("value", Environment.GetResourceString("Argum
entOutOfRange_SmallCapacity"));
}
int capacity = this.Capacity;
if (value == 0 && this.m_ChunkPrevious == null)
{
this.m_ChunkLength = 0;
this.m_ChunkOffset = 0;
return;
}
int num = value - this.Length;
if (num > 0)
{
this.Append('\0', num);
return;
}
StringBuilder stringBuilder = this.FindChunkForIndex(value);
if (stringBuilder != this)
{
int num2 = capacity - stringBuilder.m_ChunkOffset;
char[] array = new char[num2];
Array.Copy(stringBuilder.m_ChunkChars, array, stringBuilder.m_ChunkLength);
this.m_ChunkChars = array;
this.m_ChunkPrevious = stringBuilder.m_ChunkPrevious;
this.m_ChunkOffset = stringBuilder.m_ChunkOffset;
}
this.m_ChunkLength = value - stringBuilder.m_ChunkOffset;
}
}

/// <summary>Gets or sets the character at the specified character position in this instance.</summ
ary>
/// <param name="index">The position of the character. </param>
/// <returns>The Unicode character at position <paramref name="index" />.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is outside the bounds of this instance while setting a character. </e
xception>
/// <exception cref="T:System.IndexOutOfRangeException">
/// <paramref name="index" /> is outside the bounds of this instance while getting a character. </
exception>
// Token: 0x17001175 RID: 4469
[__DynamicallyInvokable]
public char this[int index]
{
[__DynamicallyInvokable]
get
{
StringBuilder stringBuilder = this;
int num;
for (;;)
{
num = index - stringBuilder.m_ChunkOffset;
if (num >= 0)
{
break;
}
stringBuilder = stringBuilder.m_ChunkPrevious;
if (stringBuilder == null)
{
goto Block_3;
}
}
if (num >= stringBuilder.m_ChunkLength)
{
throw new IndexOutOfRangeException();
}
return stringBuilder.m_ChunkChars[num];
Block_3:
throw new IndexOutOfRangeException();
}
[__DynamicallyInvokable]
set
{
StringBuilder stringBuilder = this;
int num;
for (;;)
{
num = index - stringBuilder.m_ChunkOffset;
if (num >= 0)
{
break;
}
stringBuilder = stringBuilder.m_ChunkPrevious;
if (stringBuilder == null)
{
goto Block_3;
}
}
if (num >= stringBuilder.m_ChunkLength)
{
throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("Argum
entOutOfRange_Index"));
}
stringBuilder.m_ChunkChars[num] = value;
return;
Block_3:
throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("Argume
ntOutOfRange_Index"));
}
}

/// <summary>Appends a specified number of copies of the string representation of a Unicode char
acter to this instance.</summary>
/// <param name="value">The character to append. </param>
/// <param name="repeatCount">The number of times to append <paramref name="value" />. </p
aram>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="repeatCount" /> is less than zero.-
or- Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacit
y" />. </exception>
/// <exception cref="T:System.OutOfMemoryException">Out of memory.</exception>
// Token: 0x06006592 RID: 26002 RVA: 0x00154D0C File Offset: 0x00152F0C
[__DynamicallyInvokable]
public StringBuilder Append(char value, int repeatCount)
{
if (repeatCount < 0)
{
throw new ArgumentOutOfRangeException("repeatCount", Environment.GetResourceString("A
rgumentOutOfRange_NegativeCount"));
}
if (repeatCount == 0)
{
return this;
}
int num = this.m_ChunkLength;
while (repeatCount > 0)
{
if (num < this.m_ChunkChars.Length)
{
this.m_ChunkChars[num++] = value;
repeatCount--;
}
else
{
this.m_ChunkLength = num;
this.ExpandByABlock(repeatCount);
num = 0;
}
}
this.m_ChunkLength = num;
return this;
}

/// <summary>Appends the string representation of a specified subarray of Unicode characters to t


his instance.</summary>
/// <param name="value">A character array. </param>
/// <param name="startIndex">The starting position in <paramref name="value" />. </param>
/// <param name="charCount">The number of characters to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="value" /> is null, and <paramref name="startIndex" /> and <paramref name=
"charCount" /> are not zero. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="charCount" /> is less than zero.-
or- <paramref name="startIndex" /> is less than zero.-
or- <paramref name="startIndex" /> + <paramref name="charCount" /> is greater than the length of <pa
ramref name="value" />.-
or- Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacit
y" />. </exception>
// Token: 0x06006593 RID: 26003 RVA: 0x00154D7C File Offset: 0x00152F7C
[SecuritySafeCritical]
[__DynamicallyInvokable]
public unsafe StringBuilder Append(char[] value, int startIndex, int charCount)
{
if (startIndex < 0)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("Arg
umentOutOfRange_GenericPositive"));
}
if (charCount < 0)
{
throw new ArgumentOutOfRangeException("count", Environment.GetResourceString("Argume
ntOutOfRange_GenericPositive"));
}
if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8 && charCount == 0)
{
return this;
}
if (value == null)
{
if (startIndex == 0 && charCount == 0)
{
return this;
}
throw new ArgumentNullException("value");
}
else
{
if (charCount > value.Length - startIndex)
{
throw new ArgumentOutOfRangeException("count", Environment.GetResourceString("Argu
mentOutOfRange_Index"));
}
if (charCount == 0)
{
return this;
}
fixed (char* ptr = &value[startIndex])
{
this.Append(ptr, charCount);
}
return this;
}
}

/// <summary>Appends a copy of the specified string to this instance.</summary>


/// <param name="value">The string to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x06006594 RID: 26004 RVA: 0x00154E18 File Offset: 0x00153018
[SecuritySafeCritical]
[__DynamicallyInvokable]
public unsafe StringBuilder Append(string value)
{
if (value != null)
{
char[] chunkChars = this.m_ChunkChars;
int chunkLength = this.m_ChunkLength;
int length = value.Length;
int num = chunkLength + length;
if (num < chunkChars.Length)
{
if (length <= 2)
{
if (length > 0)
{
chunkChars[chunkLength] = value[0];
}
if (length > 1)
{
chunkChars[chunkLength + 1] = value[1];
}
}
else
{
fixed (string text = value)
{
char* ptr = text;
if (ptr != null)
{
ptr += RuntimeHelpers.OffsetToStringData / 2;
}
fixed (char* ptr2 = &chunkChars[chunkLength])
{
string.wstrcpy(ptr2, ptr, length);
}
}
}
this.m_ChunkLength = num;
}
else
{
this.AppendHelper(value);
}
}
return this;
}

// Token: 0x06006595 RID: 26005 RVA: 0x00154EB0 File Offset: 0x001530B0


[SecuritySafeCritical]
private unsafe void AppendHelper(string value)
{
fixed (string text = value)
{
char* ptr = text;
if (ptr != null)
{
ptr += RuntimeHelpers.OffsetToStringData / 2;
}
this.Append(ptr, value.Length);
}
}

// Token: 0x06006596 RID: 26006


[SecurityCritical]
[MethodImpl(MethodImplOptions.InternalCall)]
internal unsafe extern void ReplaceBufferInternal(char* newBuffer, int newLength);

// Token: 0x06006597 RID: 26007


[SecurityCritical]
[MethodImpl(MethodImplOptions.InternalCall)]
internal unsafe extern void ReplaceBufferAnsiInternal(sbyte* newBuffer, int newLength);

/// <summary>Appends a copy of a specified substring to this instance.</summary>


/// <param name="value">The string that contains the substring to append. </param>
/// <param name="startIndex">The starting position of the substring within <paramref name="valu
e" />. </param>
/// <param name="count">The number of characters in <paramref name="value" /> to append. </p
aram>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="value" /> is null, and <paramref name="startIndex" /> and <paramref name=
"count" /> are not zero. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="count" /> less than zero.-
or- <paramref name="startIndex" /> less than zero.-
or- <paramref name="startIndex" /> + <paramref name="count" /> is greater than the length of <param
ref name="value" />.-
or- Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacit
y" />. </exception>
// Token: 0x06006598 RID: 26008 RVA: 0x00154EE0 File Offset: 0x001530E0
[SecuritySafeCritical]
[__DynamicallyInvokable]
public unsafe StringBuilder Append(string value, int startIndex, int count)
{
if (startIndex < 0)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("Arg
umentOutOfRange_Index"));
}
if (count < 0)
{
throw new ArgumentOutOfRangeException("count", Environment.GetResourceString("Argume
ntOutOfRange_GenericPositive"));
}
if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8 && count == 0)
{
return this;
}
if (value == null)
{
if (startIndex == 0 && count == 0)
{
return this;
}
throw new ArgumentNullException("value");
}
else
{
if (count == 0)
{
return this;
}
if (startIndex > value.Length - count)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("A
rgumentOutOfRange_Index"));
}
fixed (string text = value)
{
char* ptr = text;
if (ptr != null)
{
ptr += RuntimeHelpers.OffsetToStringData / 2;
}
this.Append(ptr + startIndex, count);
}
return this;
}
}

/// <summary>Appends the default line terminator to the end of the current <see cref="T:System.T
ext.StringBuilder" /> object.</summary>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x06006599 RID: 26009 RVA: 0x00154F87 File Offset: 0x00153187
[ComVisible(false)]
[__DynamicallyInvokable]
public StringBuilder AppendLine()
{
return this.Append(Environment.NewLine);
}

/// <summary>Appends a copy of the specified string followed by the default line terminator to the
end of the current <see cref="T:System.Text.StringBuilder" /> object.</summary>
/// <param name="value">The string to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x0600659A RID: 26010 RVA: 0x00154F94 File Offset: 0x00153194
[ComVisible(false)]
[__DynamicallyInvokable]
public StringBuilder AppendLine(string value)
{
this.Append(value);
return this.Append(Environment.NewLine);
}

/// <summary>Copies the characters from a specified segment of this instance to a specified segme
nt of a destination <see cref="T:System.Char" /> array.</summary>
/// <param name="sourceIndex">The starting position in this instance where characters will be copi
ed from. The index is zero-based.</param>
/// <param name="destination">The array where characters will be copied.</param>
/// <param name="destinationIndex">The starting position in <paramref name="destination" /> wh
ere characters will be copied. The index is zero-based.</param>
/// <param name="count">The number of characters to be copied.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="destination" /> is null.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="sourceIndex" />, <paramref name="destinationIndex" />, or <paramref nam
e="count" />, is less than zero.-or-
<paramref name="sourceIndex" /> is greater than the length of this instance.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="sourceIndex" /> + <paramref name="count" /> is greater than the length of t
his instance.-or-
<paramref name="destinationIndex" /> + <paramref name="count" /> is greater than the length of <par
amref name="destination" />.</exception>
// Token: 0x0600659B RID: 26011 RVA: 0x00154FAC File Offset: 0x001531AC
[ComVisible(false)]
[SecuritySafeCritical]
[__DynamicallyInvokable]
public void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count)
{
if (destination == null)
{
throw new ArgumentNullException("destination");
}
if (count < 0)
{
throw new ArgumentOutOfRangeException("count", Environment.GetResourceString("Arg_Ne
gativeArgCount"));
}
if (destinationIndex < 0)
{
throw new ArgumentOutOfRangeException("destinationIndex", Environment.GetResourceStrin
g("ArgumentOutOfRange_MustBeNonNegNum", new object[]
{
"destinationIndex"
}));
}
if (destinationIndex > destination.Length - count)
{
throw new ArgumentException(Environment.GetResourceString("ArgumentOutOfRange_Offset
Out"));
}
if (sourceIndex > this.Length)
{
throw new ArgumentOutOfRangeException("sourceIndex", Environment.GetResourceString("A
rgumentOutOfRange_Index"));
}
if (sourceIndex > this.Length - count)
{
throw new ArgumentException(Environment.GetResourceString("Arg_LongerThanSrcString"));
}
StringBuilder stringBuilder = this;
int num = sourceIndex + count;
int num2 = destinationIndex + count;
while (count > 0)
{
int num3 = num - stringBuilder.m_ChunkOffset;
if (num3 >= 0)
{
if (num3 > stringBuilder.m_ChunkLength)
{
num3 = stringBuilder.m_ChunkLength;
}
int num4 = count;
int num5 = num3 - count;
if (num5 < 0)
{
num4 += num5;
num5 = 0;
}
num2 -= num4;
count -= num4;
StringBuilder.ThreadSafeCopy(stringBuilder.m_ChunkChars, num5, destination, num2, num4
);
}
stringBuilder = stringBuilder.m_ChunkPrevious;
}
}

/// <summary>Inserts one or more copies of a specified string into this instance at the specified cha
racter position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The string to insert. </param>
/// <param name="count">The number of times to insert <paramref name="value" />. </param>
/// <returns>A reference to this instance after insertion has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the current length of this instance.
-or- <paramref name="count" /> is less than zero. </exception>
/// <exception cref="T:System.OutOfMemoryException">The current length of this <see cref="T:Sys
tem.Text.StringBuilder" /> object plus the length of <paramref name="value" /> times <paramref name=
"count" /> exceeds <see cref="P:System.Text.StringBuilder.MaxCapacity" />.</exception>
// Token: 0x0600659C RID: 26012 RVA: 0x001550C8 File Offset: 0x001532C8
[SecuritySafeCritical]
[__DynamicallyInvokable]
public unsafe StringBuilder Insert(int index, string value, int count)
{
if (count < 0)
{
throw new ArgumentOutOfRangeException("count", Environment.GetResourceString("Argume
ntOutOfRange_NeedNonNegNum"));
}
int length = this.Length;
if (index > length)
{
throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("Argume
ntOutOfRange_Index"));
}
if (value == null || value.Length == 0 || count == 0)
{
return this;
}
long num = (long)value.Length * (long)count;
if (num > (long)(this.MaxCapacity - this.Length))
{
throw new OutOfMemoryException();
}
StringBuilder stringBuilder;
int num2;
this.MakeRoom(index, (int)num, out stringBuilder, out num2, false);
fixed (string text = value)
{
char* ptr = text;
if (ptr != null)
{
ptr += RuntimeHelpers.OffsetToStringData / 2;
}
while (count > 0)
{
this.ReplaceInPlaceAtChunk(ref stringBuilder, ref num2, ptr, value.Length);
count--;
}
}
return this;
}

/// <summary>Removes the specified range of characters from this instance.</summary>


/// <param name="startIndex">The zero-
based position in this instance where removal begins. </param>
/// <param name="length">The number of characters to remove. </param>
/// <returns>A reference to this instance after the excise operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">If <paramref name="startIndex" />
or <paramref name="length" /> is less than zero, or <paramref name="startIndex" /> + <paramref name
="length" /> is greater than the length of this instance. </exception>
// Token: 0x0600659D RID: 26013 RVA: 0x00155188 File Offset: 0x00153388
[__DynamicallyInvokable]
public StringBuilder Remove(int startIndex, int length)
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("Argume
ntOutOfRange_NegativeLength"));
}
if (startIndex < 0)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("Arg
umentOutOfRange_StartIndex"));
}
if (length > this.Length - startIndex)
{
throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("Argume
ntOutOfRange_Index"));
}
if (this.Length == length && startIndex == 0)
{
this.Length = 0;
return this;
}
if (length > 0)
{
StringBuilder stringBuilder;
int num;
this.Remove(startIndex, length, out stringBuilder, out num);
}
return this;
}

/// <summary>Appends the string representation of a specified Boolean value to this instance.</su
mmary>
/// <param name="value">The Boolean value to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x0600659E RID: 26014 RVA: 0x0015520D File Offset: 0x0015340D
[__DynamicallyInvokable]
public StringBuilder Append(bool value)
{
return this.Append(value.ToString());
}

/// <summary>Appends the string representation of a specified 8-


bit signed integer to this instance.</summary>
/// <param name="value">The value to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x0600659F RID: 26015 RVA: 0x0015521C File Offset: 0x0015341C
[CLSCompliant(false)]
[__DynamicallyInvokable]
public StringBuilder Append(sbyte value)
{
return this.Append(value.ToString(CultureInfo.CurrentCulture));
}

/// <summary>Appends the string representation of a specified 8-


bit unsigned integer to this instance.</summary>
/// <param name="value">The value to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065A0 RID: 26016 RVA: 0x00155230 File Offset: 0x00153430
[__DynamicallyInvokable]
public StringBuilder Append(byte value)
{
return this.Append(value.ToString(CultureInfo.CurrentCulture));
}

/// <summary>Appends the string representation of a specified <see cref="T:System.Char" /> object
to this instance.</summary>
/// <param name="value">The UTF-16-encoded code unit to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065A1 RID: 26017 RVA: 0x00155244 File Offset: 0x00153444
[__DynamicallyInvokable]
public StringBuilder Append(char value)
{
if (this.m_ChunkLength < this.m_ChunkChars.Length)
{
char[] chunkChars = this.m_ChunkChars;
int chunkLength = this.m_ChunkLength;
this.m_ChunkLength = chunkLength + 1;
chunkChars[chunkLength] = value;
}
else
{
this.Append(value, 1);
}
return this;
}

/// <summary>Appends the string representation of a specified 16-


bit signed integer to this instance.</summary>
/// <param name="value">The value to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065A2 RID: 26018 RVA: 0x00155286 File Offset: 0x00153486
[__DynamicallyInvokable]
public StringBuilder Append(short value)
{
return this.Append(value.ToString(CultureInfo.CurrentCulture));
}

/// <summary>Appends the string representation of a specified 32-


bit signed integer to this instance.</summary>
/// <param name="value">The value to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065A3 RID: 26019 RVA: 0x0015529A File Offset: 0x0015349A
[__DynamicallyInvokable]
public StringBuilder Append(int value)
{
return this.Append(value.ToString(CultureInfo.CurrentCulture));
}

/// <summary>Appends the string representation of a specified 64-


bit signed integer to this instance.</summary>
/// <param name="value">The value to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065A4 RID: 26020 RVA: 0x001552AE File Offset: 0x001534AE
[__DynamicallyInvokable]
public StringBuilder Append(long value)
{
return this.Append(value.ToString(CultureInfo.CurrentCulture));
}

/// <summary>Appends the string representation of a specified single-precision floating-


point number to this instance.</summary>
/// <param name="value">The value to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065A5 RID: 26021 RVA: 0x001552C2 File Offset: 0x001534C2
[__DynamicallyInvokable]
public StringBuilder Append(float value)
{
return this.Append(value.ToString(CultureInfo.CurrentCulture));
}

/// <summary>Appends the string representation of a specified double-precision floating-


point number to this instance.</summary>
/// <param name="value">The value to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065A6 RID: 26022 RVA: 0x001552D6 File Offset: 0x001534D6
[__DynamicallyInvokable]
public StringBuilder Append(double value)
{
return this.Append(value.ToString(CultureInfo.CurrentCulture));
}

/// <summary>Appends the string representation of a specified decimal number to this instance.</s
ummary>
/// <param name="value">The value to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065A7 RID: 26023 RVA: 0x001552EA File Offset: 0x001534EA
[__DynamicallyInvokable]
public StringBuilder Append(decimal value)
{
return this.Append(value.ToString(CultureInfo.CurrentCulture));
}

/// <summary>Appends the string representation of a specified 16-


bit unsigned integer to this instance.</summary>
/// <param name="value">The value to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065A8 RID: 26024 RVA: 0x001552FE File Offset: 0x001534FE
[CLSCompliant(false)]
[__DynamicallyInvokable]
public StringBuilder Append(ushort value)
{
return this.Append(value.ToString(CultureInfo.CurrentCulture));
}

/// <summary>Appends the string representation of a specified 32-


bit unsigned integer to this instance.</summary>
/// <param name="value">The value to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065A9 RID: 26025 RVA: 0x00155312 File Offset: 0x00153512
[CLSCompliant(false)]
[__DynamicallyInvokable]
public StringBuilder Append(uint value)
{
return this.Append(value.ToString(CultureInfo.CurrentCulture));
}

/// <summary>Appends the string representation of a specified 64-


bit unsigned integer to this instance.</summary>
/// <param name="value">The value to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065AA RID: 26026 RVA: 0x00155326 File Offset: 0x00153526
[CLSCompliant(false)]
[__DynamicallyInvokable]
public StringBuilder Append(ulong value)
{
return this.Append(value.ToString(CultureInfo.CurrentCulture));
}

/// <summary>Appends the string representation of a specified object to this instance.</summary>


/// <param name="value">The object to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065AB RID: 26027 RVA: 0x0015533A File Offset: 0x0015353A
[__DynamicallyInvokable]
public StringBuilder Append(object value)
{
if (value == null)
{
return this;
}
return this.Append(value.ToString());
}

/// <summary>Appends the string representation of the Unicode characters in a specified array to t
his instance.</summary>
/// <param name="value">The array of characters to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065AC RID: 26028 RVA: 0x00155350 File Offset: 0x00153550
[SecuritySafeCritical]
[__DynamicallyInvokable]
public unsafe StringBuilder Append(char[] value)
{
if (value != null && value.Length != 0)
{
fixed (char* ptr = &value[0])
{
this.Append(ptr, value.Length);
}
}
return this;
}

/// <summary>Inserts a string into this instance at the specified character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The string to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the current length of this instance.
-or-
The current length of this <see cref="T:System.Text.StringBuilder" /> object plus the length of <paramref
name="value" /> exceeds <see cref="P:System.Text.StringBuilder.MaxCapacity" />.</exception>
// Token: 0x060065AD RID: 26029 RVA: 0x0015537C File Offset: 0x0015357C
[SecuritySafeCritical]
[__DynamicallyInvokable]
public unsafe StringBuilder Insert(int index, string value)
{
if (index > this.Length)
{
throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("Argume
ntOutOfRange_Index"));
}
if (value != null)
{
fixed (string text = value)
{
char* ptr = text;
if (ptr != null)
{
ptr += RuntimeHelpers.OffsetToStringData / 2;
}
this.Insert(index, ptr, value.Length);
}
}
return this;
}

/// <summary>Inserts the string representation of a Boolean value into this instance at the specified
character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The value to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the length of this instance.</excep
tion>
/// <exception cref="T:System.OutOfMemoryException">Enlarging the value of this instance would
exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />.</exception>
// Token: 0x060065AE RID: 26030 RVA: 0x001553CB File Offset: 0x001535CB
[__DynamicallyInvokable]
public StringBuilder Insert(int index, bool value)
{
return this.Insert(index, value.ToString(), 1);
}

/// <summary>Inserts the string representation of a specified 8-


bit signed integer into this instance at the specified character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The value to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the length of this instance. </exce
ption>
/// <exception cref="T:System.OutOfMemoryException">Enlarging the value of this instance would
exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />.</exception>
// Token: 0x060065AF RID: 26031 RVA: 0x001553DC File Offset: 0x001535DC
[CLSCompliant(false)]
[__DynamicallyInvokable]
public StringBuilder Insert(int index, sbyte value)
{
return this.Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
}

/// <summary>Inserts the string representation of a specified 8-


bit unsigned integer into this instance at the specified character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The value to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the length of this instance. </exce
ption>
/// <exception cref="T:System.OutOfMemoryException">Enlarging the value of this instance would
exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />.</exception>
// Token: 0x060065B0 RID: 26032 RVA: 0x001553F2 File Offset: 0x001535F2
[__DynamicallyInvokable]
public StringBuilder Insert(int index, byte value)
{
return this.Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
}
/// <summary>Inserts the string representation of a specified 16-
bit signed integer into this instance at the specified character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The value to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the length of this instance. </exce
ption>
/// <exception cref="T:System.OutOfMemoryException">Enlarging the value of this instance would
exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />.</exception>
// Token: 0x060065B1 RID: 26033 RVA: 0x00155408 File Offset: 0x00153608
[__DynamicallyInvokable]
public StringBuilder Insert(int index, short value)
{
return this.Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
}

/// <summary>Inserts the string representation of a specified Unicode character into this instance a
t the specified character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The value to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the length of this instance.-
or- Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacit
y" />. </exception>
// Token: 0x060065B2 RID: 26034 RVA: 0x0015541E File Offset: 0x0015361E
[SecuritySafeCritical]
[__DynamicallyInvokable]
public unsafe StringBuilder Insert(int index, char value)
{
this.Insert(index, &value, 1);
return this;
}

/// <summary>Inserts the string representation of a specified array of Unicode characters into this i
nstance at the specified character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The character array to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the length of this instance.-
or- Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacit
y" />. </exception>
// Token: 0x060065B3 RID: 26035 RVA: 0x0015542C File Offset: 0x0015362C
[__DynamicallyInvokable]
public StringBuilder Insert(int index, char[] value)
{
if (index > this.Length)
{
throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("Argume
ntOutOfRange_Index"));
}
if (value != null)
{
this.Insert(index, value, 0, value.Length);
}
return this;
}

/// <summary>Inserts the string representation of a specified subarray of Unicode characters into t
his instance at the specified character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">A character array. </param>
/// <param name="startIndex">The starting index within <paramref name="value" />. </param>
/// <param name="charCount">The number of characters to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="value" /> is null, and <paramref name="startIndex" /> and <paramref name=
"charCount" /> are not zero. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" />, <paramref name="startIndex" />, or <paramref name="charCount
" /> is less than zero.-or- <paramref name="index" /> is greater than the length of this instance.-
or- <paramref name="startIndex" /> plus <paramref name="charCount" /> is not a position within <para
mref name="value" />.-
or- Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacit
y" />. </exception>
// Token: 0x060065B4 RID: 26036 RVA: 0x00155460 File Offset: 0x00153660
[SecuritySafeCritical]
[__DynamicallyInvokable]
public unsafe StringBuilder Insert(int index, char[] value, int startIndex, int charCount)
{
int length = this.Length;
if (index > length)
{
throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("Argume
ntOutOfRange_Index"));
}
if (value == null)
{
if (startIndex == 0 && charCount == 0)
{
return this;
}
throw new ArgumentNullException(Environment.GetResourceString("ArgumentNull_String"));
}
else
{
if (startIndex < 0)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("A
rgumentOutOfRange_StartIndex"));
}
if (charCount < 0)
{
throw new ArgumentOutOfRangeException("count", Environment.GetResourceString("Argu
mentOutOfRange_GenericPositive"));
}
if (startIndex > value.Length - charCount)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("A
rgumentOutOfRange_Index"));
}
if (charCount > 0)
{
fixed (char* ptr = &value[startIndex])
{
this.Insert(index, ptr, charCount);
}
}
return this;
}
}

/// <summary>Inserts the string representation of a specified 32-


bit signed integer into this instance at the specified character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The value to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the length of this instance. </exce
ption>
/// <exception cref="T:System.OutOfMemoryException">Enlarging the value of this instance would
exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />.</exception>
// Token: 0x060065B5 RID: 26037 RVA: 0x00155516 File Offset: 0x00153716
[__DynamicallyInvokable]
public StringBuilder Insert(int index, int value)
{
return this.Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
}

/// <summary>Inserts the string representation of a 64-


bit signed integer into this instance at the specified character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The value to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the length of this instance. </exce
ption>
/// <exception cref="T:System.OutOfMemoryException">Enlarging the value of this instance would
exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />.</exception>
// Token: 0x060065B6 RID: 26038 RVA: 0x0015552C File Offset: 0x0015372C
[__DynamicallyInvokable]
public StringBuilder Insert(int index, long value)
{
return this.Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
}

/// <summary>Inserts the string representation of a single-


precision floating point number into this instance at the specified character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The value to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the length of this instance. </exce
ption>
/// <exception cref="T:System.OutOfMemoryException">Enlarging the value of this instance would
exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />.</exception>
// Token: 0x060065B7 RID: 26039 RVA: 0x00155542 File Offset: 0x00153742
[__DynamicallyInvokable]
public StringBuilder Insert(int index, float value)
{
return this.Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
}
/// <summary>Inserts the string representation of a double-precision floating-
point number into this instance at the specified character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The value to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the length of this instance. </exce
ption>
/// <exception cref="T:System.OutOfMemoryException">Enlarging the value of this instance would
exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />.</exception>
// Token: 0x060065B8 RID: 26040 RVA: 0x00155558 File Offset: 0x00153758
[__DynamicallyInvokable]
public StringBuilder Insert(int index, double value)
{
return this.Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
}

/// <summary>Inserts the string representation of a decimal number into this instance at the specifi
ed character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The value to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the length of this instance. </exce
ption>
/// <exception cref="T:System.OutOfMemoryException">Enlarging the value of this instance would
exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />.</exception>
// Token: 0x060065B9 RID: 26041 RVA: 0x0015556E File Offset: 0x0015376E
[__DynamicallyInvokable]
public StringBuilder Insert(int index, decimal value)
{
return this.Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
}

/// <summary>Inserts the string representation of a 16-


bit unsigned integer into this instance at the specified character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The value to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the length of this instance. </exce
ption>
/// <exception cref="T:System.OutOfMemoryException">Enlarging the value of this instance would
exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />.</exception>
// Token: 0x060065BA RID: 26042 RVA: 0x00155584 File Offset: 0x00153784
[CLSCompliant(false)]
[__DynamicallyInvokable]
public StringBuilder Insert(int index, ushort value)
{
return this.Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
}

/// <summary>Inserts the string representation of a 32-


bit unsigned integer into this instance at the specified character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The value to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the length of this instance. </exce
ption>
/// <exception cref="T:System.OutOfMemoryException">Enlarging the value of this instance would
exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />.</exception>
// Token: 0x060065BB RID: 26043 RVA: 0x0015559A File Offset: 0x0015379A
[CLSCompliant(false)]
[__DynamicallyInvokable]
public StringBuilder Insert(int index, uint value)
{
return this.Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
}

/// <summary>Inserts the string representation of a 64-


bit unsigned integer into this instance at the specified character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The value to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the length of this instance. </exce
ption>
/// <exception cref="T:System.OutOfMemoryException">Enlarging the value of this instance would
exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />.</exception>
// Token: 0x060065BC RID: 26044 RVA: 0x001555B0 File Offset: 0x001537B0
[CLSCompliant(false)]
[__DynamicallyInvokable]
public StringBuilder Insert(int index, ulong value)
{
return this.Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
}
/// <summary>Inserts the string representation of an object into this instance at the specified chara
cter position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The object to insert, or null. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the length of this instance. </exce
ption>
/// <exception cref="T:System.OutOfMemoryException">Enlarging the value of this instance would
exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />.</exception>
// Token: 0x060065BD RID: 26045 RVA: 0x001555C6 File Offset: 0x001537C6
[__DynamicallyInvokable]
public StringBuilder Insert(int index, object value)
{
if (value == null)
{
return this;
}
return this.Insert(index, value.ToString(), 1);
}

/// <summary>Appends the string returned by processing a composite format string, which contains
zero or more format items, to this instance. Each format item is replaced by the string representation of
a single argument.</summary>
/// <param name="format">A composite format string (see Remarks). </param>
/// <param name="arg0">An object to format. </param>
/// <returns>A reference to this instance with <paramref name="format" /> appended. Each format
item in <paramref name="format" /> is replaced by the string representation of <paramref name="arg0
" />.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="format" /> is null. </exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="format" /> is invalid. -or-
The index of a format item is less than 0 (zero), or greater than or equal to 1.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of the expanded string
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065BE RID: 26046 RVA: 0x001555DB File Offset: 0x001537DB
[__DynamicallyInvokable]
public StringBuilder AppendFormat(string format, object arg0)
{
return this.AppendFormatHelper(null, format, new ParamsArray(arg0));
}

/// <summary>Appends the string returned by processing a composite format string, which contains
zero or more format items, to this instance. Each format item is replaced by the string representation of
either of two arguments.</summary>
/// <param name="format">A composite format string (see Remarks). </param>
/// <param name="arg0">The first object to format. </param>
/// <param name="arg1">The second object to format. </param>
/// <returns>A reference to this instance with <paramref name="format" /> appended. Each format
item in <paramref name="format" /> is replaced by the string representation of the corresponding obje
ct argument.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="format" /> is null. </exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="format" /> is invalid.-or-
The index of a format item is less than 0 (zero), or greater than or equal to 2. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of the expanded string
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065BF RID: 26047 RVA: 0x001555EB File Offset: 0x001537EB
[__DynamicallyInvokable]
public StringBuilder AppendFormat(string format, object arg0, object arg1)
{
return this.AppendFormatHelper(null, format, new ParamsArray(arg0, arg1));
}

/// <summary>Appends the string returned by processing a composite format string, which contains
zero or more format items, to this instance. Each format item is replaced by the string representation of
either of three arguments.</summary>
/// <param name="format">A composite format string (see Remarks). </param>
/// <param name="arg0">The first object to format. </param>
/// <param name="arg1">The second object to format. </param>
/// <param name="arg2">The third object to format. </param>
/// <returns>A reference to this instance with <paramref name="format" /> appended. Each format
item in <paramref name="format" /> is replaced by the string representation of the corresponding obje
ct argument.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="format" /> is null. </exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="format" /> is invalid.-or-
The index of a format item is less than 0 (zero), or greater than or equal to 3.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of the expanded string
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065C0 RID: 26048 RVA: 0x001555FC File Offset: 0x001537FC
[__DynamicallyInvokable]
public StringBuilder AppendFormat(string format, object arg0, object arg1, object arg2)
{
return this.AppendFormatHelper(null, format, new ParamsArray(arg0, arg1, arg2));
}

/// <summary>Appends the string returned by processing a composite format string, which contains
zero or more format items, to this instance. Each format item is replaced by the string representation of
a corresponding argument in a parameter array.</summary>
/// <param name="format">A composite format string (see Remarks). </param>
/// <param name="args">An array of objects to format. </param>
/// <returns>A reference to this instance with <paramref name="format" /> appended. Each format
item in <paramref name="format" /> is replaced by the string representation of the corresponding obje
ct argument.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="format" /> or <paramref name="args" /> is null. </exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="format" /> is invalid. -or-
The index of a format item is less than 0 (zero), or greater than or equal to the length of the <paramref n
ame="args" /> array.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of the expanded string
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065C1 RID: 26049 RVA: 0x0015560F File Offset: 0x0015380F
[__DynamicallyInvokable]
public StringBuilder AppendFormat(string format, params object[] args)
{
if (args == null)
{
throw new ArgumentNullException((format == null) ? "format" : "args");
}
return this.AppendFormatHelper(null, format, new ParamsArray(args));
}

/// <summary>Appends the string returned by processing a composite format string, which contains
zero or more format items, to this instance. Each format item is replaced by the string representation of
a single argument using a specified format provider. </summary>
/// <param name="provider">An object that supplies culture-
specific formatting information. </param>
/// <param name="format">A composite format string (see Remarks). </param>
/// <param name="arg0">The object to format. </param>
/// <returns>A reference to this instance after the append operation has completed. After the appe
nd operation, this instance contains any data that existed before the operation, suffixed by a copy of <p
aramref name="format" /> in which any format specification is replaced by the string representation of
<paramref name="arg0" />. </returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="format" /> is null. </exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="format" /> is invalid. -or-
The index of a format item is less than 0 (zero), or greater than or equal to one (1). </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of the expanded string
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065C2 RID: 26050 RVA: 0x00155637 File Offset: 0x00153837
[__DynamicallyInvokable]
public StringBuilder AppendFormat(IFormatProvider provider, string format, object arg0)
{
return this.AppendFormatHelper(provider, format, new ParamsArray(arg0));
}

/// <summary>Appends the string returned by processing a composite format string, which contains
zero or more format items, to this instance. Each format item is replaced by the string representation of
either of two arguments using a specified format provider.</summary>
/// <param name="provider">An object that supplies culture-
specific formatting information. </param>
/// <param name="format">A composite format string (see Remarks). </param>
/// <param name="arg0">The first object to format. </param>
/// <param name="arg1">The second object to format. </param>
/// <returns>A reference to this instance after the append operation has completed. After the appe
nd operation, this instance contains any data that existed before the operation, suffixed by a copy of <p
aramref name="format" /> where any format specification is replaced by the string representation of th
e corresponding object argument. </returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="format" /> is null. </exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="format" /> is invalid. -or-
The index of a format item is less than 0 (zero), or greater than or equal to 2 (two). </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of the expanded string
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065C3 RID: 26051 RVA: 0x00155647 File Offset: 0x00153847
[__DynamicallyInvokable]
public StringBuilder AppendFormat(IFormatProvider provider, string format, object arg0, object arg
1)
{
return this.AppendFormatHelper(provider, format, new ParamsArray(arg0, arg1));
}

/// <summary>Appends the string returned by processing a composite format string, which contains
zero or more format items, to this instance. Each format item is replaced by the string representation of
either of three arguments using a specified format provider.</summary>
/// <param name="provider">An object that supplies culture-
specific formatting information. </param>
/// <param name="format">A composite format string (see Remarks). </param>
/// <param name="arg0">The first object to format. </param>
/// <param name="arg1">The second object to format. </param>
/// <param name="arg2">The third object to format. </param>
/// <returns>A reference to this instance after the append operation has completed. After the appe
nd operation, this instance contains any data that existed before the operation, suffixed by a copy of <p
aramref name="format" /> where any format specification is replaced by the string representation of th
e corresponding object argument. </returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="format" /> is null. </exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="format" /> is invalid. -or-
The index of a format item is less than 0 (zero), or greater than or equal to 3 (three). </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of the expanded string
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065C4 RID: 26052 RVA: 0x00155659 File Offset: 0x00153859
[__DynamicallyInvokable]
public StringBuilder AppendFormat(IFormatProvider provider, string format, object arg0, object arg
1, object arg2)
{
return this.AppendFormatHelper(provider, format, new ParamsArray(arg0, arg1, arg2));
}

/// <summary>Appends the string returned by processing a composite format string, which contains
zero or more format items, to this instance. Each format item is replaced by the string representation of
a corresponding argument in a parameter array using a specified format provider.</summary>
/// <param name="provider">An object that supplies culture-
specific formatting information. </param>
/// <param name="format">A composite format string (see Remarks). </param>
/// <param name="args">An array of objects to format.</param>
/// <returns>A reference to this instance after the append operation has completed. After the appe
nd operation, this instance contains any data that existed before the operation, suffixed by a copy of <p
aramref name="format" /> where any format specification is replaced by the string representation of th
e corresponding object argument. </returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="format" /> is null. </exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="format" /> is invalid. -or-
The index of a format item is less than 0 (zero), or greater than or equal to the length of the <paramref n
ame="args" /> array.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of the expanded string
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065C5 RID: 26053 RVA: 0x0015566D File Offset: 0x0015386D
[__DynamicallyInvokable]
public StringBuilder AppendFormat(IFormatProvider provider, string format, params object[] args)
{
if (args == null)
{
throw new ArgumentNullException((format == null) ? "format" : "args");
}
return this.AppendFormatHelper(provider, format, new ParamsArray(args));
}

// Token: 0x060065C6 RID: 26054 RVA: 0x00155695 File Offset: 0x00153895


private static void FormatError()
{
throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
}

// Token: 0x060065C7 RID: 26055 RVA: 0x001556A8 File Offset: 0x001538A8


internal StringBuilder AppendFormatHelper(IFormatProvider provider, string format, ParamsArray
args)
{
if (format == null)
{
throw new ArgumentNullException("format");
}
int i = 0;
int length = format.Length;
char c = '\0';
ICustomFormatter customFormatter = null;
if (provider != null)
{
customFormatter = (ICustomFormatter)provider.GetFormat(typeof(ICustomFormatter));
}
for (;;)
{
while (i < length)
{
c = format[i];
i++;
if (c == '}')
{
if (i < length && format[i] == '}')
{
i++;
}
else
{
StringBuilder.FormatError();
}
}
if (c == '{')
{
if (i >= length || format[i] != '{')
{
i--;
break;
}
i++;
}
this.Append(c);
}
if (i == length)
{
return this;
}
i++;
if (i == length || (c = format[i]) < '0' || c > '9')
{
StringBuilder.FormatError();
}
int num = 0;
do
{
num = num * 10 + (int)c - 48;
i++;
if (i == length)
{
StringBuilder.FormatError();
}
c = format[i];
}
while (c >= '0' && c <= '9' && num < 1000000);
if (num >= args.Length)
{
break;
}
while (i < length && (c = format[i]) == ' ')
{
i++;
}
bool flag = false;
int num2 = 0;
if (c == ',')
{
i++;
while (i < length && format[i] == ' ')
{
i++;
}
if (i == length)
{
StringBuilder.FormatError();
}
c = format[i];
if (c == '-')
{
flag = true;
i++;
if (i == length)
{
StringBuilder.FormatError();
}
c = format[i];
}
if (c < '0' || c > '9')
{
StringBuilder.FormatError();
}
do
{
num2 = num2 * 10 + (int)c - 48;
i++;
if (i == length)
{
StringBuilder.FormatError();
}
c = format[i];
if (c < '0' || c > '9')
{
break;
}
}
while (num2 < 1000000);
}
while (i < length && (c = format[i]) == ' ')
{
i++;
}
object obj = args[num];
StringBuilder stringBuilder = null;
if (c == ':')
{
i++;
for (;;)
{
if (i == length)
{
StringBuilder.FormatError();
}
c = format[i];
i++;
if (c == '{')
{
if (i < length && format[i] == '{')
{
i++;
}
else
{
StringBuilder.FormatError();
}
}
else if (c == '}')
{
if (i >= length || format[i] != '}')
{
break;
}
i++;
}
if (stringBuilder == null)
{
stringBuilder = new StringBuilder();
}
stringBuilder.Append(c);
}
i--;
}
if (c != '}')
{
StringBuilder.FormatError();
}
i++;
string text = null;
string text2 = null;
if (customFormatter != null)
{
if (stringBuilder != null)
{
text = stringBuilder.ToString();
}
text2 = customFormatter.Format(text, obj, provider);
}
if (text2 == null)
{
IFormattable formattable = obj as IFormattable;
if (formattable != null)
{
if (text == null && stringBuilder != null)
{
text = stringBuilder.ToString();
}
text2 = formattable.ToString(text, provider);
}
else if (obj != null)
{
text2 = obj.ToString();
}
}
if (text2 == null)
{
text2 = string.Empty;
}
int num3 = num2 - text2.Length;
if (!flag && num3 > 0)
{
this.Append(' ', num3);
}
this.Append(text2);
if (flag && num3 > 0)
{
this.Append(' ', num3);
}
}
throw new FormatException(Environment.GetResourceString("Format_IndexOutOfRange"));
}

/// <summary>Replaces all occurrences of a specified string in this instance with another specified s
tring.</summary>
/// <param name="oldValue">The string to replace. </param>
/// <param name="newValue">The string that replaces <paramref name="oldValue" />, or null. </p
aram>
/// <returns>A reference to this instance with all instances of <paramref name="oldValue" /> replac
ed by <paramref name="newValue" />.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="oldValue" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">The length of <paramref name="oldValue" /> is
zero. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065C8 RID: 26056 RVA: 0x001559CF File Offset: 0x00153BCF
[__DynamicallyInvokable]
public StringBuilder Replace(string oldValue, string newValue)
{
return this.Replace(oldValue, newValue, 0, this.Length);
}

/// <summary>Returns a value indicating whether this instance is equal to a specified object.</sum
mary>
/// <param name="sb">An object to compare with this instance, or null. </param>
/// <returns>true if this instance and <paramref name="sb" /> have equal string, <see cref="P:Syste
m.Text.StringBuilder.Capacity" />, and <see cref="P:System.Text.StringBuilder.MaxCapacity" /> values; o
therwise, false.</returns>
// Token: 0x060065C9 RID: 26057 RVA: 0x001559E0 File Offset: 0x00153BE0
[__DynamicallyInvokable]
public bool Equals(StringBuilder sb)
{
if (sb == null)
{
return false;
}
if (this.Capacity != sb.Capacity || this.MaxCapacity != sb.MaxCapacity || this.Length != sb.Length)
{
return false;
}
if (sb == this)
{
return true;
}
StringBuilder stringBuilder = this;
int i = stringBuilder.m_ChunkLength;
StringBuilder stringBuilder2 = sb;
int j = stringBuilder2.m_ChunkLength;
for (;;)
{
IL_49:
i--;
j--;
while (i < 0)
{
stringBuilder = stringBuilder.m_ChunkPrevious;
if (stringBuilder != null)
{
i = stringBuilder.m_ChunkLength + i;
}
else
{
IL_7F:
while (j < 0)
{
stringBuilder2 = stringBuilder2.m_ChunkPrevious;
if (stringBuilder2 == null)
{
break;
}
j = stringBuilder2.m_ChunkLength + j;
}
if (i < 0)
{
goto Block_8;
}
if (j < 0)
{
return false;
}
if (stringBuilder.m_ChunkChars[i] != stringBuilder2.m_ChunkChars[j])
{
return false;
}
goto IL_49;
}
}
goto IL_7F;
}
Block_8:
return j < 0;
}

/// <summary>Replaces, within a substring of this instance, all occurrences of a specified string with
another specified string.</summary>
/// <param name="oldValue">The string to replace. </param>
/// <param name="newValue">The string that replaces <paramref name="oldValue" />, or null. </p
aram>
/// <param name="startIndex">The position in this instance where the substring begins. </param>
/// <param name="count">The length of the substring. </param>
/// <returns>A reference to this instance with all instances of <paramref name="oldValue" /> replac
ed by <paramref name="newValue" /> in the range from <paramref name="startIndex" /> to <paramref
name="startIndex" /> + <paramref name="count" /> - 1.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="oldValue" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">The length of <paramref name="oldValue" /> is
zero. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="startIndex" /> or <paramref name="count" /> is less than zero.-
or- <paramref name="startIndex" /> plus <paramref name="count" /> indicates a character position not
within this instance.-
or- Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacit
y" />. </exception>
// Token: 0x060065CA RID: 26058 RVA: 0x00155A94 File Offset: 0x00153C94
[__DynamicallyInvokable]
public StringBuilder Replace(string oldValue, string newValue, int startIndex, int count)
{
int length = this.Length;
if (startIndex > length)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("Arg
umentOutOfRange_Index"));
}
if (count < 0 || startIndex > length - count)
{
throw new ArgumentOutOfRangeException("count", Environment.GetResourceString("Argume
ntOutOfRange_Index"));
}
if (oldValue == null)
{
throw new ArgumentNullException("oldValue");
}
if (oldValue.Length == 0)
{
throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "ol
dValue");
}
if (newValue == null)
{
newValue = "";
}
int num = newValue.Length - oldValue.Length;
int[] array = null;
int num2 = 0;
StringBuilder stringBuilder = this.FindChunkForIndex(startIndex);
int num3 = startIndex - stringBuilder.m_ChunkOffset;
while (count > 0)
{
if (this.StartsWith(stringBuilder, num3, count, oldValue))
{
if (array == null)
{
array = new int[5];
}
else if (num2 >= array.Length)
{
int[] array2 = new int[array.Length * 3 / 2 + 4];
Array.Copy(array, array2, array.Length);
array = array2;
}
array[num2++] = num3;
num3 += oldValue.Length;
count -= oldValue.Length;
}
else
{
num3++;
count--;
}
if (num3 >= stringBuilder.m_ChunkLength || count == 0)
{
int num4 = num3 + stringBuilder.m_ChunkOffset;
this.ReplaceAllInChunk(array, num2, stringBuilder, oldValue.Length, newValue);
num4 += (newValue.Length - oldValue.Length) * num2;
num2 = 0;
stringBuilder = this.FindChunkForIndex(num4);
num3 = num4 - stringBuilder.m_ChunkOffset;
}
}
return this;
}

/// <summary>Replaces all occurrences of a specified character in this instance with another specifi
ed character.</summary>
/// <param name="oldChar">The character to replace. </param>
/// <param name="newChar">The character that replaces <paramref name="oldChar" />. </param>
/// <returns>A reference to this instance with <paramref name="oldChar" /> replaced by <paramref
name="newChar" />.</returns>
// Token: 0x060065CB RID: 26059 RVA: 0x00155C13 File Offset: 0x00153E13
[__DynamicallyInvokable]
public StringBuilder Replace(char oldChar, char newChar)
{
return this.Replace(oldChar, newChar, 0, this.Length);
}

/// <summary>Replaces, within a substring of this instance, all occurrences of a specified character
with another specified character.</summary>
/// <param name="oldChar">The character to replace. </param>
/// <param name="newChar">The character that replaces <paramref name="oldChar" />. </param>
/// <param name="startIndex">The position in this instance where the substring begins. </param>
/// <param name="count">The length of the substring. </param>
/// <returns>A reference to this instance with <paramref name="oldChar" /> replaced by <paramref
name="newChar" /> in the range from <paramref name="startIndex" /> to <paramref name="startInde
x" /> + <paramref name="count" /> -1.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="startIndex" /> + <paramref name="count" /> is greater than the length of th
e value of this instance.-
or- <paramref name="startIndex" /> or <paramref name="count" /> is less than zero. </exception>
// Token: 0x060065CC RID: 26060 RVA: 0x00155C24 File Offset: 0x00153E24
[__DynamicallyInvokable]
public StringBuilder Replace(char oldChar, char newChar, int startIndex, int count)
{
int length = this.Length;
if (startIndex > length)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("Arg
umentOutOfRange_Index"));
}
if (count < 0 || startIndex > length - count)
{
throw new ArgumentOutOfRangeException("count", Environment.GetResourceString("Argume
ntOutOfRange_Index"));
}
int num = startIndex + count;
StringBuilder stringBuilder = this;
for (;;)
{
int num2 = num - stringBuilder.m_ChunkOffset;
int num3 = startIndex - stringBuilder.m_ChunkOffset;
if (num2 >= 0)
{
int i = Math.Max(num3, 0);
int num4 = Math.Min(stringBuilder.m_ChunkLength, num2);
while (i < num4)
{
if (stringBuilder.m_ChunkChars[i] == oldChar)
{
stringBuilder.m_ChunkChars[i] = newChar;
}
i++;
}
}
if (num3 >= 0)
{
break;
}
stringBuilder = stringBuilder.m_ChunkPrevious;
}
return this;
}

/// <summary>Appends an array of Unicode characters starting at a specified address to this instanc
e. </summary>
/// <param name="value">A pointer to an array of characters. </param>
/// <param name="valueCount">The number of characters in the array. </param>
/// <returns>A reference to this instance after the append operation has completed. </returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="valueCount" /> is less than zero. -or-
Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity"
/>. </exception>
/// <exception cref="T:System.NullReferenceException">
/// <paramref name="value" /> is a null pointer. </exception>
// Token: 0x060065CD RID: 26061 RVA: 0x00155CDC File Offset: 0x00153EDC
[SecurityCritical]
[CLSCompliant(false)]
public unsafe StringBuilder Append(char* value, int valueCount)
{
if (valueCount < 0)
{
throw new ArgumentOutOfRangeException("valueCount", Environment.GetResourceString("Ar
gumentOutOfRange_NegativeCount"));
}
int num = valueCount + this.m_ChunkLength;
if (num <= this.m_ChunkChars.Length)
{
StringBuilder.ThreadSafeCopy(value, this.m_ChunkChars, this.m_ChunkLength, valueCount);
this.m_ChunkLength = num;
}
else
{
int num2 = this.m_ChunkChars.Length - this.m_ChunkLength;
if (num2 > 0)
{
StringBuilder.ThreadSafeCopy(value, this.m_ChunkChars, this.m_ChunkLength, num2);
this.m_ChunkLength = this.m_ChunkChars.Length;
}
int num3 = valueCount - num2;
this.ExpandByABlock(num3);
StringBuilder.ThreadSafeCopy(value + num2, this.m_ChunkChars, 0, num3);
this.m_ChunkLength = num3;
}
return this;
}

// Token: 0x060065CE RID: 26062 RVA: 0x00155D90 File Offset: 0x00153F90


[SecurityCritical]
private unsafe void Insert(int index, char* value, int valueCount)
{
if (index > this.Length)
{
throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("Argume
ntOutOfRange_Index"));
}
if (valueCount > 0)
{
StringBuilder stringBuilder;
int num;
this.MakeRoom(index, valueCount, out stringBuilder, out num, false);
this.ReplaceInPlaceAtChunk(ref stringBuilder, ref num, value, valueCount);
}
}

// Token: 0x060065CF RID: 26063 RVA: 0x00155DD8 File Offset: 0x00153FD8


[SecuritySafeCritical]
private unsafe void ReplaceAllInChunk(int[] replacements, int replacementsCount, StringBuilder so
urceChunk, int removeCount, string value)
{
if (replacementsCount <= 0)
{
return;
}
fixed (string text = value)
{
char* ptr = text;
if (ptr != null)
{
ptr += RuntimeHelpers.OffsetToStringData / 2;
}
int num = (value.Length - removeCount) * replacementsCount;
StringBuilder stringBuilder = sourceChunk;
int num2 = replacements[0];
if (num > 0)
{
this.MakeRoom(stringBuilder.m_ChunkOffset + num2, num, out stringBuilder, out num2, tru
e);
}
int num3 = 0;
for (;;)
{
this.ReplaceInPlaceAtChunk(ref stringBuilder, ref num2, ptr, value.Length);
int num4 = replacements[num3] + removeCount;
num3++;
if (num3 >= replacementsCount)
{
break;
}
int num5 = replacements[num3];
if (num != 0)
{
fixed (char* ptr2 = &sourceChunk.m_ChunkChars[num4])
{
this.ReplaceInPlaceAtChunk(ref stringBuilder, ref num2, ptr2, num5 - num4);
}
}
else
{
num2 += num5 - num4;
}
}
if (num < 0)
{
this.Remove(stringBuilder.m_ChunkOffset + num2, -num, out stringBuilder, out num2);
}
}
}

// Token: 0x060065D0 RID: 26064 RVA: 0x00155EA8 File Offset: 0x001540A8


private bool StartsWith(StringBuilder chunk, int indexInChunk, int count, string value)
{
for (int i = 0; i < value.Length; i++)
{
if (count == 0)
{
return false;
}
if (indexInChunk >= chunk.m_ChunkLength)
{
chunk = this.Next(chunk);
if (chunk == null)
{
return false;
}
indexInChunk = 0;
}
if (value[i] != chunk.m_ChunkChars[indexInChunk])
{
return false;
}
indexInChunk++;
count--;
}
return true;
}

// Token: 0x060065D1 RID: 26065 RVA: 0x00155F08 File Offset: 0x00154108


[SecurityCritical]
private unsafe void ReplaceInPlaceAtChunk(ref StringBuilder chunk, ref int indexInChunk, char* val
ue, int count)
{
if (count != 0)
{
for (;;)
{
int val = chunk.m_ChunkLength - indexInChunk;
int num = Math.Min(val, count);
StringBuilder.ThreadSafeCopy(value, chunk.m_ChunkChars, indexInChunk, num);
indexInChunk += num;
if (indexInChunk >= chunk.m_ChunkLength)
{
chunk = this.Next(chunk);
indexInChunk = 0;
}
count -= num;
if (count == 0)
{
break;
}
value += num;
}
}
}

// Token: 0x060065D2 RID: 26066 RVA: 0x00155F70 File Offset: 0x00154170


[SecurityCritical]
private unsafe static void ThreadSafeCopy(char* sourcePtr, char[] destination, int destinationIndex
, int count)
{
if (count <= 0)
{
return;
}
if (destinationIndex <= destination.Length && destinationIndex + count <= destination.Length)
{
fixed (char* ptr = &destination[destinationIndex])
{
string.wstrcpy(ptr, sourcePtr, count);
}
return;
}
throw new ArgumentOutOfRangeException("destinationIndex", Environment.GetResourceString(
"ArgumentOutOfRange_Index"));
}

// Token: 0x060065D3 RID: 26067 RVA: 0x00155FBC File Offset: 0x001541BC


[SecurityCritical]
private unsafe static void ThreadSafeCopy(char[] source, int sourceIndex, char[] destination, int des
tinationIndex, int count)
{
if (count <= 0)
{
return;
}
if (sourceIndex <= source.Length && sourceIndex + count <= source.Length)
{
fixed (char* ptr = &source[sourceIndex])
{
StringBuilder.ThreadSafeCopy(ptr, destination, destinationIndex, count);
}
return;
}
throw new ArgumentOutOfRangeException("sourceIndex", Environment.GetResourceString("Arg
umentOutOfRange_Index"));
}

// Token: 0x060065D4 RID: 26068 RVA: 0x0015600C File Offset: 0x0015420C


[SecurityCritical]
internal unsafe void InternalCopy(IntPtr dest, int len)
{
if (len == 0)
{
return;
}
bool flag = true;
byte* ptr = (byte*)dest.ToPointer();
StringBuilder stringBuilder = this.FindChunkForByte(len);
do
{
int num = stringBuilder.m_ChunkOffset * 2;
int len2 = stringBuilder.m_ChunkLength * 2;
fixed (char* ptr2 = &stringBuilder.m_ChunkChars[0])
{
byte* src = (byte*)ptr2;
if (flag)
{
flag = false;
Buffer.Memcpy(ptr + num, src, len - num);
}
else
{
Buffer.Memcpy(ptr + num, src, len2);
}
}
stringBuilder = stringBuilder.m_ChunkPrevious;
}
while (stringBuilder != null);
}

// Token: 0x060065D5 RID: 26069 RVA: 0x00156084 File Offset: 0x00154284


private StringBuilder FindChunkForIndex(int index)
{
StringBuilder stringBuilder = this;
while (stringBuilder.m_ChunkOffset > index)
{
stringBuilder = stringBuilder.m_ChunkPrevious;
}
return stringBuilder;
}

// Token: 0x060065D6 RID: 26070 RVA: 0x001560A8 File Offset: 0x001542A8


private StringBuilder FindChunkForByte(int byteIndex)
{
StringBuilder stringBuilder = this;
while (stringBuilder.m_ChunkOffset * 2 > byteIndex)
{
stringBuilder = stringBuilder.m_ChunkPrevious;
}
return stringBuilder;
}

// Token: 0x060065D7 RID: 26071 RVA: 0x001560CC File Offset: 0x001542CC


private StringBuilder Next(StringBuilder chunk)
{
if (chunk == this)
{
return null;
}
return this.FindChunkForIndex(chunk.m_ChunkOffset + chunk.m_ChunkLength);
}

// Token: 0x060065D8 RID: 26072 RVA: 0x001560E8 File Offset: 0x001542E8


private void ExpandByABlock(int minBlockCharCount)
{
if (minBlockCharCount + this.Length < minBlockCharCount || minBlockCharCount + this.Length >
this.m_MaxCapacity)
{
throw new ArgumentOutOfRangeException("requiredLength", Environment.GetResourceString
("ArgumentOutOfRange_SmallCapacity"));
}
int num = Math.Max(minBlockCharCount, Math.Min(this.Length, 8000));
this.m_ChunkPrevious = new StringBuilder(this);
this.m_ChunkOffset += this.m_ChunkLength;
this.m_ChunkLength = 0;
if (this.m_ChunkOffset + num < num)
{
this.m_ChunkChars = null;
throw new OutOfMemoryException();
}
this.m_ChunkChars = new char[num];
}

// Token: 0x060065D9 RID: 26073 RVA: 0x00156188 File Offset: 0x00154388


private StringBuilder(StringBuilder from)
{
this.m_ChunkLength = from.m_ChunkLength;
this.m_ChunkOffset = from.m_ChunkOffset;
this.m_ChunkChars = from.m_ChunkChars;
this.m_ChunkPrevious = from.m_ChunkPrevious;
this.m_MaxCapacity = from.m_MaxCapacity;
}

// Token: 0x060065DA RID: 26074 RVA: 0x001561D8 File Offset: 0x001543D8


[SecuritySafeCritical]
private unsafe void MakeRoom(int index, int count, out StringBuilder chunk, out int indexInChunk,
bool doneMoveFollowingChars)
{
if (count + this.Length < count || count + this.Length > this.m_MaxCapacity)
{
throw new ArgumentOutOfRangeException("requiredLength", Environment.GetResourceString
("ArgumentOutOfRange_SmallCapacity"));
}
chunk = this;
while (chunk.m_ChunkOffset > index)
{
chunk.m_ChunkOffset += count;
chunk = chunk.m_ChunkPrevious;
}
indexInChunk = index - chunk.m_ChunkOffset;
if (!doneMoveFollowingChars && chunk.m_ChunkLength <= 32 && chunk.m_ChunkChars.Length
- chunk.m_ChunkLength >= count)
{
int i = chunk.m_ChunkLength;
while (i > indexInChunk)
{
i--;
chunk.m_ChunkChars[i + count] = chunk.m_ChunkChars[i];
}
chunk.m_ChunkLength += count;
return;
}
StringBuilder stringBuilder = new StringBuilder(Math.Max(count, 16), chunk.m_MaxCapacity, chu
nk.m_ChunkPrevious);
stringBuilder.m_ChunkLength = count;
int num = Math.Min(count, indexInChunk);
if (num > 0)
{
fixed (char* chunkChars = chunk.m_ChunkChars)
{
StringBuilder.ThreadSafeCopy(chunkChars, stringBuilder.m_ChunkChars, 0, num);
int num2 = indexInChunk - num;
if (num2 >= 0)
{
StringBuilder.ThreadSafeCopy(chunkChars + num, chunk.m_ChunkChars, 0, num2);
indexInChunk = num2;
}
}
}
chunk.m_ChunkPrevious = stringBuilder;
chunk.m_ChunkOffset += count;
if (num < count)
{
chunk = stringBuilder;
indexInChunk = num;
}
}
// Token: 0x060065DB RID: 26075 RVA: 0x0015634F File Offset: 0x0015454F
private StringBuilder(int size, int maxCapacity, StringBuilder previousBlock)
{
this.m_ChunkChars = new char[size];
this.m_MaxCapacity = maxCapacity;
this.m_ChunkPrevious = previousBlock;
if (previousBlock != null)
{
this.m_ChunkOffset = previousBlock.m_ChunkOffset + previousBlock.m_ChunkLength;
}
}

// Token: 0x060065DC RID: 26076 RVA: 0x00156388 File Offset: 0x00154588


[SecuritySafeCritical]
private void Remove(int startIndex, int count, out StringBuilder chunk, out int indexInChunk)
{
int num = startIndex + count;
chunk = this;
StringBuilder stringBuilder = null;
int num2 = 0;
for (;;)
{
if (num - chunk.m_ChunkOffset >= 0)
{
if (stringBuilder == null)
{
stringBuilder = chunk;
num2 = num - stringBuilder.m_ChunkOffset;
}
if (startIndex - chunk.m_ChunkOffset >= 0)
{
break;
}
}
else
{
chunk.m_ChunkOffset -= count;
}
chunk = chunk.m_ChunkPrevious;
}
indexInChunk = startIndex - chunk.m_ChunkOffset;
int num3 = indexInChunk;
int count2 = stringBuilder.m_ChunkLength - num2;
if (stringBuilder != chunk)
{
num3 = 0;
chunk.m_ChunkLength = indexInChunk;
stringBuilder.m_ChunkPrevious = chunk;
stringBuilder.m_ChunkOffset = chunk.m_ChunkOffset + chunk.m_ChunkLength;
if (indexInChunk == 0)
{
stringBuilder.m_ChunkPrevious = chunk.m_ChunkPrevious;
chunk = stringBuilder;
}
}
stringBuilder.m_ChunkLength -= num2 - num3;
if (num3 != num2)
{
StringBuilder.ThreadSafeCopy(stringBuilder.m_ChunkChars, num2, stringBuilder.m_ChunkChar
s, num3, count2);
}
}

// Token: 0x04002D33 RID: 11571


internal char[] m_ChunkChars;

// Token: 0x04002D34 RID: 11572


internal StringBuilder m_ChunkPrevious;

// Token: 0x04002D35 RID: 11573


internal int m_ChunkLength;

// Token: 0x04002D36 RID: 11574


internal int m_ChunkOffset;

// Token: 0x04002D37 RID: 11575


internal int m_MaxCapacity;

// Token: 0x04002D38 RID: 11576


internal const int DefaultCapacity = 16;

// Token: 0x04002D39 RID: 11577


private const string CapacityField = "Capacity";

// Token: 0x04002D3A RID: 11578


private const string MaxCapacityField = "m_MaxCapacity";

// Token: 0x04002D3B RID: 11579


private const string StringValueField = "m_StringValue";

// Token: 0x04002D3C RID: 11580


private const string ThreadIDField = "m_currentThread";

// Token: 0x04002D3D RID: 11581


internal const int MaxChunkSize = 8000;
}
}

You might also like