scripts
This commit is contained in:
@@ -0,0 +1,600 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Represents an ASCII character encoding of Unicode characters.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x020005DE RID: 1502
|
||||
[ComVisible(true)]
|
||||
[MonoTODO("Serialization format not compatible with .NET")]
|
||||
[Serializable]
|
||||
public class ASCIIEncoding : Encoding
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.ASCIIEncoding" /> class.</summary>
|
||||
// Token: 0x060036B6 RID: 14006 RVA: 0x000BB950 File Offset: 0x000B9B50
|
||||
public ASCIIEncoding()
|
||||
: base(20127)
|
||||
{
|
||||
this.body_name = (this.header_name = (this.web_name = "us-ascii"));
|
||||
this.encoding_name = "US-ASCII";
|
||||
this.is_mail_news_display = true;
|
||||
this.is_mail_news_save = true;
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the current encoding uses single-byte code points.</summary>
|
||||
/// <returns>This property is always true.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AB4 RID: 2740
|
||||
// (get) Token: 0x060036B7 RID: 14007 RVA: 0x000BB9A0 File Offset: 0x000B9BA0
|
||||
[ComVisible(false)]
|
||||
public override bool IsSingleByte
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of bytes produced by encoding a set of characters from the specified character array.</summary>
|
||||
/// <returns>The number of bytes produced by encoding the specified characters.</returns>
|
||||
/// <param name="chars">The character array containing the set of characters to encode.</param>
|
||||
/// <param name="index">The index of the first character to encode.</param>
|
||||
/// <param name="count">The number of characters to encode.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="chars" />.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060036B8 RID: 14008 RVA: 0x000BB9A4 File Offset: 0x000B9BA4
|
||||
public override int GetByteCount(char[] chars, int index, int count)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (index < 0 || index > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (count < 0 || count > chars.Length - index)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of bytes produced by encoding the characters in the specified <see cref="T:System.String" />.</summary>
|
||||
/// <returns>The number of bytes produced by encoding the specified characters.</returns>
|
||||
/// <param name="chars">The <see cref="T:System.String" /> containing the set of characters to encode.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060036B9 RID: 14009 RVA: 0x000BBA10 File Offset: 0x000B9C10
|
||||
public override int GetByteCount(string chars)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
return chars.Length;
|
||||
}
|
||||
|
||||
/// <summary>Encodes a set of characters from the specified character array into the specified byte array.</summary>
|
||||
/// <returns>The actual number of bytes written into <paramref name="bytes" />.</returns>
|
||||
/// <param name="chars">The character array containing the set of characters to encode.</param>
|
||||
/// <param name="charIndex">The index of the first character to encode.</param>
|
||||
/// <param name="charCount">The number of characters to encode.</param>
|
||||
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
|
||||
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null.-or- <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charIndex" /> or <paramref name="charCount" /> or <paramref name="byteIndex" /> is less than zero.-or- <paramref name="charIndex" /> and <paramref name="charCount" /> do not denote a valid range in <paramref name="chars" />.-or- <paramref name="byteIndex" /> is not a valid index in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="bytes" /> does not have enough capacity from <paramref name="byteIndex" /> to the end of the array to accommodate the resulting bytes. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060036BA RID: 14010 RVA: 0x000BBA2C File Offset: 0x000B9C2C
|
||||
public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex)
|
||||
{
|
||||
EncoderFallbackBuffer encoderFallbackBuffer = null;
|
||||
char[] array = null;
|
||||
return this.GetBytes(chars, charIndex, charCount, bytes, byteIndex, ref encoderFallbackBuffer, ref array);
|
||||
}
|
||||
|
||||
// Token: 0x060036BB RID: 14011 RVA: 0x000BBA50 File Offset: 0x000B9C50
|
||||
private int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, ref EncoderFallbackBuffer buffer, ref char[] fallback_chars)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (charIndex < 0 || charIndex > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charCount < 0 || charCount > chars.Length - charIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (bytes.Length - byteIndex < charCount)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"));
|
||||
}
|
||||
int num = charCount;
|
||||
while (num-- > 0)
|
||||
{
|
||||
char c = chars[charIndex++];
|
||||
if (c < '\u0080')
|
||||
{
|
||||
bytes[byteIndex++] = (byte)c;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
buffer = base.EncoderFallback.CreateFallbackBuffer();
|
||||
}
|
||||
if (char.IsSurrogate(c) && num > 1 && char.IsSurrogate(chars[charIndex]))
|
||||
{
|
||||
buffer.Fallback(c, chars[charIndex], charIndex++ - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer.Fallback(c, charIndex - 1);
|
||||
}
|
||||
if (fallback_chars == null || fallback_chars.Length < buffer.Remaining)
|
||||
{
|
||||
fallback_chars = new char[buffer.Remaining];
|
||||
}
|
||||
for (int i = 0; i < fallback_chars.Length; i++)
|
||||
{
|
||||
fallback_chars[i] = buffer.GetNextChar();
|
||||
}
|
||||
byteIndex += this.GetBytes(fallback_chars, 0, fallback_chars.Length, bytes, byteIndex, ref buffer, ref fallback_chars);
|
||||
}
|
||||
}
|
||||
return charCount;
|
||||
}
|
||||
|
||||
/// <summary>Encodes a set of characters from the specified <see cref="T:System.String" /> into the specified byte array.</summary>
|
||||
/// <returns>The actual number of bytes written into <paramref name="bytes" />.</returns>
|
||||
/// <param name="chars">The <see cref="T:System.String" /> containing the set of characters to encode.</param>
|
||||
/// <param name="charIndex">The index of the first character to encode.</param>
|
||||
/// <param name="charCount">The number of characters to encode.</param>
|
||||
/// <param name="bytes">The byte array to contain the resulting sequence of bytes.</param>
|
||||
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="s" /> is null.-or- <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charIndex" /> or <paramref name="charCount" /> or <paramref name="byteIndex" /> is less than zero.-or- <paramref name="charIndex" /> and <paramref name="charCount" /> do not denote a valid range in <paramref name="chars" />.-or- <paramref name="byteIndex" /> is not a valid index in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="bytes" /> does not have enough capacity from <paramref name="byteIndex" /> to the end of the array to accommodate the resulting bytes. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060036BC RID: 14012 RVA: 0x000BBC10 File Offset: 0x000B9E10
|
||||
public override int GetBytes(string chars, int charIndex, int charCount, byte[] bytes, int byteIndex)
|
||||
{
|
||||
EncoderFallbackBuffer encoderFallbackBuffer = null;
|
||||
char[] array = null;
|
||||
return this.GetBytes(chars, charIndex, charCount, bytes, byteIndex, ref encoderFallbackBuffer, ref array);
|
||||
}
|
||||
|
||||
// Token: 0x060036BD RID: 14013 RVA: 0x000BBC34 File Offset: 0x000B9E34
|
||||
private int GetBytes(string chars, int charIndex, int charCount, byte[] bytes, int byteIndex, ref EncoderFallbackBuffer buffer, ref char[] fallback_chars)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (charIndex < 0 || charIndex > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex", Encoding._("ArgRange_StringIndex"));
|
||||
}
|
||||
if (charCount < 0 || charCount > chars.Length - charIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount", Encoding._("ArgRange_StringRange"));
|
||||
}
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (bytes.Length - byteIndex < charCount)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"));
|
||||
}
|
||||
int num = charCount;
|
||||
while (num-- > 0)
|
||||
{
|
||||
char c = chars[charIndex++];
|
||||
if (c < '\u0080')
|
||||
{
|
||||
bytes[byteIndex++] = (byte)c;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
buffer = base.EncoderFallback.CreateFallbackBuffer();
|
||||
}
|
||||
if (char.IsSurrogate(c) && num > 1 && char.IsSurrogate(chars[charIndex]))
|
||||
{
|
||||
buffer.Fallback(c, chars[charIndex], charIndex++ - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer.Fallback(c, charIndex - 1);
|
||||
}
|
||||
if (fallback_chars == null || fallback_chars.Length < buffer.Remaining)
|
||||
{
|
||||
fallback_chars = new char[buffer.Remaining];
|
||||
}
|
||||
for (int i = 0; i < fallback_chars.Length; i++)
|
||||
{
|
||||
fallback_chars[i] = buffer.GetNextChar();
|
||||
}
|
||||
byteIndex += this.GetBytes(fallback_chars, 0, fallback_chars.Length, bytes, byteIndex, ref buffer, ref fallback_chars);
|
||||
}
|
||||
}
|
||||
return charCount;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.</summary>
|
||||
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
|
||||
/// <param name="index">The index of the first byte to decode.</param>
|
||||
/// <param name="count">The number of bytes to decode.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="bytes" />.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060036BE RID: 14014 RVA: 0x000BBE04 File Offset: 0x000BA004
|
||||
public override int GetCharCount(byte[] bytes, int index, int count)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (index < 0 || index > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (count < 0 || count > bytes.Length - index)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/// <summary>Decodes a sequence of bytes from the specified byte array into the specified character array.</summary>
|
||||
/// <returns>The actual number of characters written into <paramref name="chars" />.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
|
||||
/// <param name="byteIndex">The index of the first byte to decode.</param>
|
||||
/// <param name="byteCount">The number of bytes to decode.</param>
|
||||
/// <param name="chars">The character array to contain the resulting set of characters.</param>
|
||||
/// <param name="charIndex">The index at which to start writing the resulting set of characters.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null.-or- <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteIndex" /> or <paramref name="byteCount" /> or <paramref name="charIndex" /> is less than zero.-or- <paramref name="byteindex" /> and <paramref name="byteCount" /> do not denote a valid range in <paramref name="bytes" />.-or- <paramref name="charIndex" /> is not a valid index in <paramref name="chars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="chars" /> does not have enough capacity from <paramref name="charIndex" /> to the end of the array to accommodate the resulting characters. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060036BF RID: 14015 RVA: 0x000BBE70 File Offset: 0x000BA070
|
||||
public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
|
||||
{
|
||||
DecoderFallbackBuffer decoderFallbackBuffer = null;
|
||||
return this.GetChars(bytes, byteIndex, byteCount, chars, charIndex, ref decoderFallbackBuffer);
|
||||
}
|
||||
|
||||
// Token: 0x060036C0 RID: 14016 RVA: 0x000BBE90 File Offset: 0x000BA090
|
||||
private int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, ref DecoderFallbackBuffer buffer)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (byteCount < 0 || byteCount > bytes.Length - byteIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charIndex < 0 || charIndex > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (chars.Length - charIndex < byteCount)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"));
|
||||
}
|
||||
int num = byteCount;
|
||||
while (num-- > 0)
|
||||
{
|
||||
char c = (char)bytes[byteIndex++];
|
||||
if (c < '\u0080')
|
||||
{
|
||||
chars[charIndex++] = c;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
buffer = base.DecoderFallback.CreateFallbackBuffer();
|
||||
}
|
||||
buffer.Fallback(bytes, byteIndex);
|
||||
while (buffer.Remaining > 0)
|
||||
{
|
||||
chars[charIndex++] = buffer.GetNextChar();
|
||||
}
|
||||
}
|
||||
}
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the maximum number of bytes produced by encoding the specified number of characters.</summary>
|
||||
/// <returns>The maximum number of bytes produced by encoding the specified number of characters.</returns>
|
||||
/// <param name="charCount">The number of characters to encode.</param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charCount" /> is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060036C1 RID: 14017 RVA: 0x000BBFD0 File Offset: 0x000BA1D0
|
||||
public override int GetMaxByteCount(int charCount)
|
||||
{
|
||||
if (charCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount", Encoding._("ArgRange_NonNegative"));
|
||||
}
|
||||
return charCount;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the maximum number of characters produced by decoding the specified number of bytes.</summary>
|
||||
/// <returns>The maximum number of characters produced by decoding the specified number of bytes.</returns>
|
||||
/// <param name="byteCount">The number of bytes to decode.</param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteCount" /> is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060036C2 RID: 14018 RVA: 0x000BBFF0 File Offset: 0x000BA1F0
|
||||
public override int GetMaxCharCount(int byteCount)
|
||||
{
|
||||
if (byteCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount", Encoding._("ArgRange_NonNegative"));
|
||||
}
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
/// <summary>Decodes a range of bytes from a byte array into a string.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> containing the results of decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode.</param>
|
||||
/// <param name="byteIndex">The index of the first byte to decode.</param>
|
||||
/// <param name="byteCount">The number of bytes to decode.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060036C3 RID: 14019 RVA: 0x000BC010 File Offset: 0x000BA210
|
||||
public unsafe override string GetString(byte[] bytes, int byteIndex, int byteCount)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (byteCount < 0 || byteCount > bytes.Length - byteIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (byteCount == 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
fixed (byte* ptr = (ref bytes != null && bytes.Length != 0 ? ref bytes[0] : ref *null))
|
||||
{
|
||||
string text = string.InternalAllocateStr(byteCount);
|
||||
fixed (string text2 = text)
|
||||
{
|
||||
fixed (char* ptr2 = text2 + RuntimeHelpers.OffsetToStringData / 2)
|
||||
{
|
||||
byte* ptr3 = ptr + byteIndex;
|
||||
byte* ptr4 = ptr3 + byteCount;
|
||||
char* ptr5 = ptr2;
|
||||
while (ptr3 < ptr4)
|
||||
{
|
||||
byte b = *(ptr3++);
|
||||
*(ptr5++) = ((b > 127) ? '?' : ((char)b));
|
||||
}
|
||||
text2 = null;
|
||||
return text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Encodes a set of characters starting at the specified character pointer into a sequence of bytes that are stored starting at the specified byte pointer.</summary>
|
||||
/// <returns>The actual number of bytes written at the location indicated by <paramref name="bytes" />.</returns>
|
||||
/// <param name="chars">A pointer to the first character to encode.</param>
|
||||
/// <param name="charCount">The number of characters to encode.</param>
|
||||
/// <param name="bytes">A pointer to the location at which to start writing the resulting sequence of bytes.</param>
|
||||
/// <param name="byteCount">The maximum number of bytes to write.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null.-or- <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charCount" /> or <paramref name="byteCount" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="byteCount" /> is less than the resulting number of bytes. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060036C4 RID: 14020 RVA: 0x000BC0FC File Offset: 0x000BA2FC
|
||||
[CLSCompliant(false)]
|
||||
[ComVisible(false)]
|
||||
public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (charCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount");
|
||||
}
|
||||
if (byteCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount");
|
||||
}
|
||||
if (byteCount < charCount)
|
||||
{
|
||||
throw new ArgumentException("bytecount is less than the number of bytes required", "byteCount");
|
||||
}
|
||||
for (int i = 0; i < charCount; i++)
|
||||
{
|
||||
char c = chars[i];
|
||||
bytes[i] = (byte)((c >= '\u0080') ? '?' : c);
|
||||
}
|
||||
return charCount;
|
||||
}
|
||||
|
||||
/// <summary>Decodes a sequence of bytes starting at the specified byte pointer into a set of characters that are stored starting at the specified character pointer.</summary>
|
||||
/// <returns>The actual number of characters written at the location indicated by <paramref name="chars" />.</returns>
|
||||
/// <param name="bytes">A pointer to the first byte to decode.</param>
|
||||
/// <param name="byteCount">The number of bytes to decode.</param>
|
||||
/// <param name="chars">A pointer to the location at which to start writing the resulting set of characters.</param>
|
||||
/// <param name="charCount">The maximum number of characters to write.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null.-or- <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteCount" /> or <paramref name="charCount" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="charCount" /> is less than the resulting number of characters. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060036C5 RID: 14021 RVA: 0x000BC19C File Offset: 0x000BA39C
|
||||
[CLSCompliant(false)]
|
||||
[ComVisible(false)]
|
||||
public unsafe override int GetChars(byte* bytes, int byteCount, char* chars, int charCount)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (charCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount");
|
||||
}
|
||||
if (byteCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount");
|
||||
}
|
||||
if (charCount < byteCount)
|
||||
{
|
||||
throw new ArgumentException("charcount is less than the number of bytes required", "charCount");
|
||||
}
|
||||
for (int i = 0; i < byteCount; i++)
|
||||
{
|
||||
byte b = bytes[i];
|
||||
chars[i] = ((b <= 127) ? ((char)b) : '?');
|
||||
}
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of characters produced by decoding a sequence of bytes starting at the specified byte pointer.</summary>
|
||||
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">A pointer to the first byte to decode.</param>
|
||||
/// <param name="count">The number of bytes to decode.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="count" /> is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060036C6 RID: 14022 RVA: 0x000BC238 File Offset: 0x000BA438
|
||||
[ComVisible(false)]
|
||||
[CLSCompliant(false)]
|
||||
public unsafe override int GetCharCount(byte* bytes, int count)
|
||||
{
|
||||
return count;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of bytes produced by encoding a set of characters starting at the specified character pointer.</summary>
|
||||
/// <returns>The number of bytes produced by encoding the specified characters.</returns>
|
||||
/// <param name="chars">A pointer to the first character to encode.</param>
|
||||
/// <param name="count">The number of characters to encode.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="count" /> is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060036C7 RID: 14023 RVA: 0x000BC23C File Offset: 0x000BA43C
|
||||
[ComVisible(false)]
|
||||
[CLSCompliant(false)]
|
||||
public unsafe override int GetByteCount(char* chars, int count)
|
||||
{
|
||||
return count;
|
||||
}
|
||||
|
||||
/// <summary>Obtains a decoder that converts an ASCII encoded sequence of bytes into a sequence of Unicode characters.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.Decoder" /> that converts an ASCII encoded sequence of bytes into a sequence of Unicode characters.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060036C8 RID: 14024 RVA: 0x000BC240 File Offset: 0x000BA440
|
||||
[ComVisible(false)]
|
||||
[MonoTODO("we have simple override to match method signature.")]
|
||||
public override Decoder GetDecoder()
|
||||
{
|
||||
return base.GetDecoder();
|
||||
}
|
||||
|
||||
/// <summary>Obtains an encoder that converts a sequence of Unicode characters into an ASCII encoded sequence of bytes.</summary>
|
||||
/// <returns>An <see cref="T:System.Text.Encoder" /> that converts a sequence of Unicode characters into an ASCII encoded sequence of bytes.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060036C9 RID: 14025 RVA: 0x000BC248 File Offset: 0x000BA448
|
||||
[ComVisible(false)]
|
||||
[MonoTODO("we have simple override to match method signature.")]
|
||||
public override Encoder GetEncoder()
|
||||
{
|
||||
return base.GetEncoder();
|
||||
}
|
||||
|
||||
// Token: 0x04001662 RID: 5730
|
||||
internal const int ASCII_CODE_PAGE = 20127;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
// Token: 0x020005DF RID: 1503
|
||||
[Serializable]
|
||||
internal sealed class CodePageEncoding : ISerializable, IObjectReference
|
||||
{
|
||||
// Token: 0x060036CA RID: 14026 RVA: 0x000BC250 File Offset: 0x000BA450
|
||||
private CodePageEncoding(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
if (info == null)
|
||||
{
|
||||
throw new ArgumentNullException("info");
|
||||
}
|
||||
this.codePage = (int)info.GetValue("m_codePage", typeof(int));
|
||||
try
|
||||
{
|
||||
this.isReadOnly = (bool)info.GetValue("m_isReadOnly", typeof(bool));
|
||||
this.encoderFallback = (EncoderFallback)info.GetValue("encoderFallback", typeof(EncoderFallback));
|
||||
this.decoderFallback = (DecoderFallback)info.GetValue("decoderFallback", typeof(DecoderFallback));
|
||||
}
|
||||
catch (SerializationException)
|
||||
{
|
||||
this.isReadOnly = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060036CB RID: 14027 RVA: 0x000BC324 File Offset: 0x000BA524
|
||||
public void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
throw new ArgumentException("This class cannot be serialized.");
|
||||
}
|
||||
|
||||
// Token: 0x060036CC RID: 14028 RVA: 0x000BC330 File Offset: 0x000BA530
|
||||
public object GetRealObject(StreamingContext context)
|
||||
{
|
||||
if (this.realObject == null)
|
||||
{
|
||||
Encoding encoding = Encoding.GetEncoding(this.codePage);
|
||||
if (!this.isReadOnly)
|
||||
{
|
||||
encoding = (Encoding)encoding.Clone();
|
||||
encoding.EncoderFallback = this.encoderFallback;
|
||||
encoding.DecoderFallback = this.decoderFallback;
|
||||
}
|
||||
this.realObject = encoding;
|
||||
}
|
||||
return this.realObject;
|
||||
}
|
||||
|
||||
// Token: 0x04001663 RID: 5731
|
||||
private int codePage;
|
||||
|
||||
// Token: 0x04001664 RID: 5732
|
||||
private bool isReadOnly;
|
||||
|
||||
// Token: 0x04001665 RID: 5733
|
||||
private EncoderFallback encoderFallback;
|
||||
|
||||
// Token: 0x04001666 RID: 5734
|
||||
private DecoderFallback decoderFallback;
|
||||
|
||||
// Token: 0x04001667 RID: 5735
|
||||
private Encoding realObject;
|
||||
|
||||
// Token: 0x020005E0 RID: 1504
|
||||
[Serializable]
|
||||
private sealed class Decoder : ISerializable, IObjectReference
|
||||
{
|
||||
// Token: 0x060036CD RID: 14029 RVA: 0x000BC390 File Offset: 0x000BA590
|
||||
private Decoder(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
if (info == null)
|
||||
{
|
||||
throw new ArgumentNullException("info");
|
||||
}
|
||||
this.encoding = (Encoding)info.GetValue("encoding", typeof(Encoding));
|
||||
}
|
||||
|
||||
// Token: 0x060036CE RID: 14030 RVA: 0x000BC3CC File Offset: 0x000BA5CC
|
||||
public void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
throw new ArgumentException("This class cannot be serialized.");
|
||||
}
|
||||
|
||||
// Token: 0x060036CF RID: 14031 RVA: 0x000BC3D8 File Offset: 0x000BA5D8
|
||||
public object GetRealObject(StreamingContext context)
|
||||
{
|
||||
if (this.realObject == null)
|
||||
{
|
||||
this.realObject = this.encoding.GetDecoder();
|
||||
}
|
||||
return this.realObject;
|
||||
}
|
||||
|
||||
// Token: 0x04001668 RID: 5736
|
||||
private Encoding encoding;
|
||||
|
||||
// Token: 0x04001669 RID: 5737
|
||||
private global::System.Text.Decoder realObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,346 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Converts a sequence of encoded bytes into a set of characters.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x020005E1 RID: 1505
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public abstract class Decoder
|
||||
{
|
||||
/// <summary>Gets or sets a <see cref="T:System.Text.DecoderFallback" /> object for the current <see cref="T:System.Text.Decoder" /> object.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.DecoderFallback" /> object.</returns>
|
||||
/// <exception cref="T:System.ArgumentNullException">The value in a set operation is null (Nothing).</exception>
|
||||
/// <exception cref="T:System.ArgumentException">A new value cannot be assigned in a set operation because the current <see cref="T:System.Text.DecoderFallbackBuffer" /> object contains data that has not been decoded yet. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000AB5 RID: 2741
|
||||
// (get) Token: 0x060036D1 RID: 14033 RVA: 0x000BC41C File Offset: 0x000BA61C
|
||||
// (set) Token: 0x060036D2 RID: 14034 RVA: 0x000BC424 File Offset: 0x000BA624
|
||||
[ComVisible(false)]
|
||||
public DecoderFallback Fallback
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.fallback;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
this.fallback = value;
|
||||
this.fallback_buffer = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the <see cref="T:System.Text.DecoderFallbackBuffer" /> object associated with the current <see cref="T:System.Text.Decoder" /> object.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.DecoderFallbackBuffer" /> object.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000AB6 RID: 2742
|
||||
// (get) Token: 0x060036D3 RID: 14035 RVA: 0x000BC440 File Offset: 0x000BA640
|
||||
[ComVisible(false)]
|
||||
public DecoderFallbackBuffer FallbackBuffer
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.fallback_buffer == null)
|
||||
{
|
||||
this.fallback_buffer = this.fallback.CreateFallbackBuffer();
|
||||
}
|
||||
return this.fallback_buffer;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.</summary>
|
||||
/// <returns>The number of characters produced by decoding the specified sequence of bytes and any bytes in the internal buffer.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <param name="index">The index of the first byte to decode. </param>
|
||||
/// <param name="count">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Decoder.Fallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060036D4 RID: 14036
|
||||
public abstract int GetCharCount(byte[] bytes, int index, int count);
|
||||
|
||||
/// <summary>When overridden in a derived class, decodes a sequence of bytes from the specified byte array and any bytes in the internal buffer into the specified character array.</summary>
|
||||
/// <returns>The actual number of characters written into <paramref name="chars" />.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <param name="byteIndex">The index of the first byte to decode. </param>
|
||||
/// <param name="byteCount">The number of bytes to decode. </param>
|
||||
/// <param name="chars">The character array to contain the resulting set of characters. </param>
|
||||
/// <param name="charIndex">The index at which to start writing the resulting set of characters. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null (Nothing).-or- <paramref name="chars" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteIndex" /> or <paramref name="byteCount" /> or <paramref name="charIndex" /> is less than zero.-or- <paramref name="byteindex" /> and <paramref name="byteCount" /> do not denote a valid range in <paramref name="bytes" />.-or- <paramref name="charIndex" /> is not a valid index in <paramref name="chars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="chars" /> does not have enough capacity from <paramref name="charIndex" /> to the end of the array to accommodate the resulting characters. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Decoder.Fallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060036D5 RID: 14037
|
||||
public abstract int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex);
|
||||
|
||||
/// <summary>When overridden in a derived class, calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. A parameter indicates whether to clear the internal state of the decoder after the calculation.</summary>
|
||||
/// <returns>The number of characters produced by decoding the specified sequence of bytes and any bytes in the internal buffer.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <param name="index">The index of the first byte to decode. </param>
|
||||
/// <param name="count">The number of bytes to decode. </param>
|
||||
/// <param name="flush">true to simulate clearing the internal state of the encoder after the calculation; otherwise, false. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Decoder.Fallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060036D6 RID: 14038 RVA: 0x000BC470 File Offset: 0x000BA670
|
||||
[ComVisible(false)]
|
||||
public virtual int GetCharCount(byte[] bytes, int index, int count, bool flush)
|
||||
{
|
||||
if (flush)
|
||||
{
|
||||
this.Reset();
|
||||
}
|
||||
return this.GetCharCount(bytes, index, count);
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, calculates the number of characters produced by decoding a sequence of bytes starting at the specified byte pointer. A parameter indicates whether to clear the internal state of the decoder after the calculation.</summary>
|
||||
/// <returns>The number of characters produced by decoding the specified sequence of bytes and any bytes in the internal buffer.</returns>
|
||||
/// <param name="bytes">A pointer to the first byte to decode. </param>
|
||||
/// <param name="count">The number of bytes to decode. </param>
|
||||
/// <param name="flush">true to simulate clearing the internal state of the encoder after the calculation; otherwise, false. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null (Nothing in Visual Basic .NET). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="count" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Decoder.Fallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060036D7 RID: 14039 RVA: 0x000BC488 File Offset: 0x000BA688
|
||||
[CLSCompliant(false)]
|
||||
[ComVisible(false)]
|
||||
public unsafe virtual int GetCharCount(byte* bytes, int count, bool flush)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count");
|
||||
}
|
||||
byte[] array = new byte[count];
|
||||
Marshal.Copy((IntPtr)((void*)bytes), array, 0, count);
|
||||
return this.GetCharCount(array, 0, count, flush);
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, decodes a sequence of bytes from the specified byte array and any bytes in the internal buffer into the specified character array. A parameter indicates whether to clear the internal state of the decoder after the conversion.</summary>
|
||||
/// <returns>The actual number of characters written into the <paramref name="chars" /> parameter.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <param name="byteIndex">The index of the first byte to decode. </param>
|
||||
/// <param name="byteCount">The number of bytes to decode. </param>
|
||||
/// <param name="chars">The character array to contain the resulting set of characters. </param>
|
||||
/// <param name="charIndex">The index at which to start writing the resulting set of characters. </param>
|
||||
/// <param name="flush">true to clear the internal state of the decoder after the conversion; otherwise, false. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null (Nothing).-or- <paramref name="chars" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteIndex" /> or <paramref name="byteCount" /> or <paramref name="charIndex" /> is less than zero.-or- <paramref name="byteindex" /> and <paramref name="byteCount" /> do not denote a valid range in <paramref name="bytes" />.-or- <paramref name="charIndex" /> is not a valid index in <paramref name="chars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="chars" /> does not have enough capacity from <paramref name="charIndex" /> to the end of the array to accommodate the resulting characters. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Decoder.Fallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060036D8 RID: 14040 RVA: 0x000BC4D8 File Offset: 0x000BA6D8
|
||||
public virtual int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, bool flush)
|
||||
{
|
||||
this.CheckArguments(bytes, byteIndex, byteCount);
|
||||
this.CheckArguments(chars, charIndex);
|
||||
if (flush)
|
||||
{
|
||||
this.Reset();
|
||||
}
|
||||
return this.GetChars(bytes, byteIndex, byteCount, chars, charIndex);
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, decodes a sequence of bytes starting at the specified byte pointer and any bytes in the internal buffer into a set of characters that are stored starting at the specified character pointer. A parameter indicates whether to clear the internal state of the decoder after the conversion.</summary>
|
||||
/// <returns>The actual number of characters written at the location indicated by the <paramref name="chars" /> parameter.</returns>
|
||||
/// <param name="bytes">A pointer to the first byte to decode. </param>
|
||||
/// <param name="byteCount">The number of bytes to decode. </param>
|
||||
/// <param name="chars">A pointer to the location at which to start writing the resulting set of characters. </param>
|
||||
/// <param name="charCount">The maximum number of characters to write. </param>
|
||||
/// <param name="flush">true to clear the internal state of the decoder after the conversion; otherwise, false. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null (Nothing).-or- <paramref name="chars" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteCount" /> or <paramref name="charCount" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="charCount" /> is less than the resulting number of characters. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Decoder.Fallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060036D9 RID: 14041 RVA: 0x000BC514 File Offset: 0x000BA714
|
||||
[ComVisible(false)]
|
||||
[CLSCompliant(false)]
|
||||
public unsafe virtual int GetChars(byte* bytes, int byteCount, char* chars, int charCount, bool flush)
|
||||
{
|
||||
this.CheckArguments(chars, charCount, bytes, byteCount);
|
||||
char[] array = new char[charCount];
|
||||
Marshal.Copy((IntPtr)((void*)chars), array, 0, charCount);
|
||||
byte[] array2 = new byte[byteCount];
|
||||
Marshal.Copy((IntPtr)((void*)bytes), array2, 0, byteCount);
|
||||
return this.GetChars(array2, 0, byteCount, array, 0, flush);
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, sets the decoder back to its initial state.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060036DA RID: 14042 RVA: 0x000BC568 File Offset: 0x000BA768
|
||||
[ComVisible(false)]
|
||||
public virtual void Reset()
|
||||
{
|
||||
if (this.fallback_buffer != null)
|
||||
{
|
||||
this.fallback_buffer.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Converts a buffer of encoded bytes to Unicode characters and stores the result in another buffer.</summary>
|
||||
/// <param name="bytes">The address of a buffer that contains the byte sequences to convert.</param>
|
||||
/// <param name="byteCount">The number of bytes in <paramref name="bytes" /> to convert.</param>
|
||||
/// <param name="chars">The address of a buffer to store the converted characters.</param>
|
||||
/// <param name="charCount">The maximum number of characters in <paramref name="chars" /> to use in the conversion.</param>
|
||||
/// <param name="flush">true to indicate no further data is to be converted; otherwise, false.</param>
|
||||
/// <param name="bytesUsed">When this method returns, contains the number of bytes that were produced by the conversion. This parameter is passed uninitialized.</param>
|
||||
/// <param name="charsUsed">When this method returns, contains the number of characters from <paramref name="chars" /> that were used in the conversion. This parameter is passed uninitialized.</param>
|
||||
/// <param name="completed">When this method returns, contains true if all the characters specified by <paramref name="byteCount" /> were converted; otherwise, false. This parameter is passed uninitialized.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> or <paramref name="bytes" /> is null (Nothing).</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charCount" /> or <paramref name="byteCount" /> is less than zero.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The output buffer is too small to contain any of the converted input. The output buffer should be greater than or equal to the size indicated by the <see cref="Overload:System.Text.Decoder.GetCharCount" /> method.</exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Decoder.Fallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060036DB RID: 14043 RVA: 0x000BC580 File Offset: 0x000BA780
|
||||
[CLSCompliant(false)]
|
||||
[ComVisible(false)]
|
||||
public unsafe virtual void Convert(byte* bytes, int byteCount, char* chars, int charCount, bool flush, out int bytesUsed, out int charsUsed, out bool completed)
|
||||
{
|
||||
this.CheckArguments(chars, charCount, bytes, byteCount);
|
||||
bytesUsed = byteCount;
|
||||
for (;;)
|
||||
{
|
||||
charsUsed = this.GetCharCount(bytes, bytesUsed, flush);
|
||||
if (charsUsed <= charCount)
|
||||
{
|
||||
break;
|
||||
}
|
||||
flush = false;
|
||||
bytesUsed >>= 1;
|
||||
}
|
||||
completed = bytesUsed == byteCount;
|
||||
charsUsed = this.GetChars(bytes, bytesUsed, chars, charCount, flush);
|
||||
}
|
||||
|
||||
/// <summary>Converts an array of encoded bytes to Unicode characters and stores the result in a byte array.</summary>
|
||||
/// <param name="bytes">A byte array to convert.</param>
|
||||
/// <param name="byteIndex">The first element of <paramref name="bytes" /> to convert.</param>
|
||||
/// <param name="byteCount">The number of elements of <paramref name="bytes" /> to convert.</param>
|
||||
/// <param name="chars">An array to store the converted characters.</param>
|
||||
/// <param name="charIndex">The first element of <paramref name="chars" /> in which data is stored.</param>
|
||||
/// <param name="charCount">The maximum number of elements of <paramref name="chars" /> to use in the conversion.</param>
|
||||
/// <param name="flush">true to indicate that no further data is to be converted; otherwise, false.</param>
|
||||
/// <param name="bytesUsed">When this method returns, contains the number of bytes that were used in the conversion. This parameter is passed uninitialized.</param>
|
||||
/// <param name="charsUsed">When this method returns, contains the number of characters from <paramref name="chars" /> that were produced by the conversion. This parameter is passed uninitialized.</param>
|
||||
/// <param name="completed">When this method returns, contains true if all the characters specified by <paramref name="byteCount" /> were converted; otherwise, false. This parameter is passed uninitialized.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> or <paramref name="bytes" /> is null (Nothing).</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charIndex" />, <paramref name="charCount" />, <paramref name="byteIndex" />, or <paramref name="byteCount" /> is less than zero.-or-The length of <paramref name="chars" /> - <paramref name="charIndex" /> is less than <paramref name="charCount" />.-or-The length of <paramref name="bytes" /> - <paramref name="byteIndex" /> is less than <paramref name="byteCount" />.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The output buffer is too small to contain any of the converted input. The output buffer should be greater than or equal to the size indicated by the <see cref="Overload:System.Text.Decoder.GetCharCount" /> method.</exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Decoder.Fallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060036DC RID: 14044 RVA: 0x000BC5E8 File Offset: 0x000BA7E8
|
||||
[ComVisible(false)]
|
||||
public virtual void Convert(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, int charCount, bool flush, out int bytesUsed, out int charsUsed, out bool completed)
|
||||
{
|
||||
this.CheckArguments(bytes, byteIndex, byteCount);
|
||||
this.CheckArguments(chars, charIndex);
|
||||
if (charCount < 0 || chars.Length < charIndex + charCount)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount");
|
||||
}
|
||||
bytesUsed = byteCount;
|
||||
for (;;)
|
||||
{
|
||||
charsUsed = this.GetCharCount(bytes, byteIndex, bytesUsed, flush);
|
||||
if (charsUsed <= charCount)
|
||||
{
|
||||
break;
|
||||
}
|
||||
flush = false;
|
||||
bytesUsed >>= 1;
|
||||
}
|
||||
completed = bytesUsed == byteCount;
|
||||
charsUsed = this.GetChars(bytes, byteIndex, bytesUsed, chars, charIndex, flush);
|
||||
}
|
||||
|
||||
// Token: 0x060036DD RID: 14045 RVA: 0x000BC67C File Offset: 0x000BA87C
|
||||
private void CheckArguments(char[] chars, int charIndex)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (charIndex < 0 || chars.Length <= charIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060036DE RID: 14046 RVA: 0x000BC6B8 File Offset: 0x000BA8B8
|
||||
private void CheckArguments(byte[] bytes, int byteIndex, int byteCount)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (byteIndex < 0 || bytes.Length <= byteIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex");
|
||||
}
|
||||
if (byteCount < 0 || bytes.Length < byteIndex + byteCount)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060036DF RID: 14047 RVA: 0x000BC710 File Offset: 0x000BA910
|
||||
private unsafe void CheckArguments(char* chars, int charCount, byte* bytes, int byteCount)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (charCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount");
|
||||
}
|
||||
if (byteCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400166A RID: 5738
|
||||
private DecoderFallback fallback = new DecoderReplacementFallback();
|
||||
|
||||
// Token: 0x0400166B RID: 5739
|
||||
private DecoderFallbackBuffer fallback_buffer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Throws <see cref="T:System.Text.DecoderFallbackException" /> if an encoded input byte sequence cannot be converted to a decoded output character. This class cannot be inherited.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020005E2 RID: 1506
|
||||
[Serializable]
|
||||
public sealed class DecoderExceptionFallback : DecoderFallback
|
||||
{
|
||||
/// <summary>Gets the maximum number of characters this instance can return.</summary>
|
||||
/// <returns>The return value is always zero.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AB7 RID: 2743
|
||||
// (get) Token: 0x060036E1 RID: 14049 RVA: 0x000BC76C File Offset: 0x000BA96C
|
||||
public override int MaxCharCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.DecoderExceptionFallback" /> class. </summary>
|
||||
/// <returns>A <see cref="T:System.Text.DecoderFallbackBuffer" /> object.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060036E2 RID: 14050 RVA: 0x000BC770 File Offset: 0x000BA970
|
||||
public override DecoderFallbackBuffer CreateFallbackBuffer()
|
||||
{
|
||||
return new DecoderExceptionFallbackBuffer();
|
||||
}
|
||||
|
||||
/// <summary>Indicates whether the current <see cref="T:System.Text.DecoderExceptionFallback" /> object and a specified object are equal.</summary>
|
||||
/// <returns>true if <paramref name="value" /> is not null and is a <see cref="T:System.Text.DecoderExceptionFallback" /> object; otherwise, false.</returns>
|
||||
/// <param name="value">An object that derives from the <see cref="T:System.Text.DecoderExceptionFallback" /> class.</param>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060036E3 RID: 14051 RVA: 0x000BC778 File Offset: 0x000BA978
|
||||
public override bool Equals(object value)
|
||||
{
|
||||
return value is DecoderExceptionFallback;
|
||||
}
|
||||
|
||||
/// <summary>Retrieves the hash code for this instance.</summary>
|
||||
/// <returns>The return value is always the same arbitrary value, and has no special significance. </returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060036E4 RID: 14052 RVA: 0x000BC784 File Offset: 0x000BA984
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Throws <see cref="T:System.Text.DecoderFallbackException" /> when an encoded input byte sequence cannot be converted to a decoded output character. This class cannot be inherited.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020005E3 RID: 1507
|
||||
public sealed class DecoderExceptionFallbackBuffer : DecoderFallbackBuffer
|
||||
{
|
||||
/// <summary>Gets the number of characters in the current <see cref="T:System.Text.DecoderExceptionFallbackBuffer" /> object that remain to be processed.</summary>
|
||||
/// <returns>The return value is always zero. A return value is defined, although it is unchanging, because this method implements an abstract method.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000AB8 RID: 2744
|
||||
// (get) Token: 0x060036E6 RID: 14054 RVA: 0x000BC790 File Offset: 0x000BA990
|
||||
public override int Remaining
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Throws <see cref="T:System.Text.DecoderFallbackException" /> when the input byte sequence cannot be decoded. The nominal return value is not used. </summary>
|
||||
/// <returns>None. No value is returned because the <see cref="M:System.Text.DecoderExceptionFallbackBuffer.Fallback(System.Byte[],System.Int32)" /> method always throws an exception. The nominal return value is true. A return value is defined, although it is unchanging, because this method implements an abstract method.</returns>
|
||||
/// <param name="bytesUnknown">An input array of bytes.</param>
|
||||
/// <param name="index">The index position of a byte in the input.</param>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">This method always throws an exception that reports the value and index position of the input byte that cannot be decoded. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060036E7 RID: 14055 RVA: 0x000BC794 File Offset: 0x000BA994
|
||||
public override bool Fallback(byte[] bytesUnknown, int index)
|
||||
{
|
||||
throw new DecoderFallbackException(null, bytesUnknown, index);
|
||||
}
|
||||
|
||||
/// <summary>Retrieves the next character in the exception data buffer.</summary>
|
||||
/// <returns>The return value is always the Unicode character NULL (U+0000). A return value is defined, although it is unchanging, because this method implements an abstract method.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060036E8 RID: 14056 RVA: 0x000BC7A0 File Offset: 0x000BA9A0
|
||||
public override char GetNextChar()
|
||||
{
|
||||
return '\0';
|
||||
}
|
||||
|
||||
/// <summary>Causes the next call to <see cref="M:System.Text.DecoderExceptionFallbackBuffer.GetNextChar" /> to access the exception data buffer character position that is prior to the current position.</summary>
|
||||
/// <returns>The return value is always false. A return value is defined, although it is unchanging, because this method implements an abstract method.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060036E9 RID: 14057 RVA: 0x000BC7A4 File Offset: 0x000BA9A4
|
||||
public override bool MovePrevious()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Provides a failure-handling mechanism, called a fallback, for an encoded input byte sequence that cannot be converted to an output character. </summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020005E4 RID: 1508
|
||||
[Serializable]
|
||||
public abstract class DecoderFallback
|
||||
{
|
||||
/// <summary>Gets an object that throws an exception when an input byte sequence cannot be decoded.</summary>
|
||||
/// <returns>A type derived from the <see cref="T:System.Text.DecoderFallback" /> class. The default value is a <see cref="T:System.Text.DecoderExceptionFallback" /> object.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000AB9 RID: 2745
|
||||
// (get) Token: 0x060036EC RID: 14060 RVA: 0x000BC7D8 File Offset: 0x000BA9D8
|
||||
public static DecoderFallback ExceptionFallback
|
||||
{
|
||||
get
|
||||
{
|
||||
return DecoderFallback.exception_fallback;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, gets the maximum number of characters the current <see cref="T:System.Text.DecoderFallback" /> object can return.</summary>
|
||||
/// <returns>The maximum number of characters the current <see cref="T:System.Text.DecoderFallback" /> object can return.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000ABA RID: 2746
|
||||
// (get) Token: 0x060036ED RID: 14061
|
||||
public abstract int MaxCharCount { get; }
|
||||
|
||||
/// <summary>Gets an object that outputs a substitute string in place of an input byte sequence that cannot be decoded.</summary>
|
||||
/// <returns>A type derived from the <see cref="T:System.Text.DecoderFallback" /> class. The default value is a <see cref="T:System.Text.DecoderReplacementFallback" /> object that emits the QUESTION MARK character ("?", U+003F) in place of unknown byte sequences. </returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000ABB RID: 2747
|
||||
// (get) Token: 0x060036EE RID: 14062 RVA: 0x000BC7E0 File Offset: 0x000BA9E0
|
||||
public static DecoderFallback ReplacementFallback
|
||||
{
|
||||
get
|
||||
{
|
||||
return DecoderFallback.replacement_fallback;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000ABC RID: 2748
|
||||
// (get) Token: 0x060036EF RID: 14063 RVA: 0x000BC7E8 File Offset: 0x000BA9E8
|
||||
internal static DecoderFallback StandardSafeFallback
|
||||
{
|
||||
get
|
||||
{
|
||||
return DecoderFallback.standard_safe_fallback;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, initializes a new instance of the <see cref="T:System.Text.DecoderFallbackBuffer" /> class. </summary>
|
||||
/// <returns>An object that provides a fallback buffer for a decoder.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060036F0 RID: 14064
|
||||
public abstract DecoderFallbackBuffer CreateFallbackBuffer();
|
||||
|
||||
// Token: 0x0400166C RID: 5740
|
||||
private static DecoderFallback exception_fallback = new DecoderExceptionFallback();
|
||||
|
||||
// Token: 0x0400166D RID: 5741
|
||||
private static DecoderFallback replacement_fallback = new DecoderReplacementFallback();
|
||||
|
||||
// Token: 0x0400166E RID: 5742
|
||||
private static DecoderFallback standard_safe_fallback = new DecoderReplacementFallback("\ufffd");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Provides a buffer that allows a fallback handler to return an alternate string to a decoder when it cannot decode an input byte sequence. </summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020005E5 RID: 1509
|
||||
public abstract class DecoderFallbackBuffer
|
||||
{
|
||||
/// <summary>When overridden in a derived class, gets the number of characters in the current <see cref="T:System.Text.DecoderFallbackBuffer" /> object that remain to be processed.</summary>
|
||||
/// <returns>The number of characters in the current fallback buffer that have not yet been processed.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000ABD RID: 2749
|
||||
// (get) Token: 0x060036F2 RID: 14066
|
||||
public abstract int Remaining { get; }
|
||||
|
||||
/// <summary>When overridden in a derived class, prepares the fallback buffer to handle the specified input byte sequence.</summary>
|
||||
/// <returns>true if the fallback buffer can process <paramref name="bytesUnknown" />; false if the fallback buffer ignores <paramref name="bytesUnknown" />.</returns>
|
||||
/// <param name="bytesUnknown">An input array of bytes.</param>
|
||||
/// <param name="index">The index position of a byte in <paramref name="bytesUnknown" />.</param>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060036F3 RID: 14067
|
||||
public abstract bool Fallback(byte[] bytesUnknown, int index);
|
||||
|
||||
/// <summary>When overridden in a derived class, retrieves the next character in the fallback buffer.</summary>
|
||||
/// <returns>The next character in the fallback buffer.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060036F4 RID: 14068
|
||||
public abstract char GetNextChar();
|
||||
|
||||
/// <summary>When overridden in a derived class, causes the next call to the <see cref="M:System.Text.DecoderFallbackBuffer.GetNextChar" /> method to access the data buffer character position that is prior to the current character position. </summary>
|
||||
/// <returns>true if the <see cref="M:System.Text.DecoderFallbackBuffer.MovePrevious" /> operation was successful; otherwise, false.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060036F5 RID: 14069
|
||||
public abstract bool MovePrevious();
|
||||
|
||||
/// <summary>Initializes all data and state information pertaining to this fallback buffer.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060036F6 RID: 14070 RVA: 0x000BC7F8 File Offset: 0x000BA9F8
|
||||
public virtual void Reset()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>The exception that is thrown when a decoder fallback operation fails. This class cannot be inherited.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020005E6 RID: 1510
|
||||
[Serializable]
|
||||
public sealed class DecoderFallbackException : ArgumentException
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.DecoderFallbackException" /> class. </summary>
|
||||
// Token: 0x060036F7 RID: 14071 RVA: 0x000BC7FC File Offset: 0x000BA9FC
|
||||
public DecoderFallbackException()
|
||||
: this(null)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.DecoderFallbackException" /> class. A parameter specifies the error message.</summary>
|
||||
/// <param name="message">An error message.</param>
|
||||
// Token: 0x060036F8 RID: 14072 RVA: 0x000BC808 File Offset: 0x000BAA08
|
||||
public DecoderFallbackException(string message)
|
||||
{
|
||||
this.index = -1;
|
||||
base..ctor(message);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.DecoderFallbackException" /> class. Parameters specify the error message and the inner exception that is the cause of this exception.</summary>
|
||||
/// <param name="message">An error message.</param>
|
||||
/// <param name="innerException">The exception that caused this exception.</param>
|
||||
// Token: 0x060036F9 RID: 14073 RVA: 0x000BC818 File Offset: 0x000BAA18
|
||||
public DecoderFallbackException(string message, Exception innerException)
|
||||
{
|
||||
this.index = -1;
|
||||
base..ctor(message, innerException);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.DecoderFallbackException" /> class. Parameters specify the error message, the array of bytes being decoded, and the index of the byte that cannot be decoded.</summary>
|
||||
/// <param name="message">An error message.</param>
|
||||
/// <param name="bytesUnknown">The input byte array.</param>
|
||||
/// <param name="index">The index position in <paramref name="bytesUnknown" /> of the byte that cannot be decoded.</param>
|
||||
// Token: 0x060036FA RID: 14074 RVA: 0x000BC82C File Offset: 0x000BAA2C
|
||||
public DecoderFallbackException(string message, byte[] bytesUnknown, int index)
|
||||
{
|
||||
this.index = -1;
|
||||
base..ctor(message);
|
||||
this.bytes_unknown = bytesUnknown;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
/// <summary>Gets the input byte sequence that caused the exception.</summary>
|
||||
/// <returns>The input byte array that cannot be decoded. </returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000ABE RID: 2750
|
||||
// (get) Token: 0x060036FB RID: 14075 RVA: 0x000BC84C File Offset: 0x000BAA4C
|
||||
[MonoTODO]
|
||||
public byte[] BytesUnknown
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.bytes_unknown;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the index position in the input byte sequence of the byte that caused the exception.</summary>
|
||||
/// <returns>The index position in the input byte array of the byte that cannot be decoded. The index position is zero-based. </returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000ABF RID: 2751
|
||||
// (get) Token: 0x060036FC RID: 14076 RVA: 0x000BC854 File Offset: 0x000BAA54
|
||||
[MonoTODO]
|
||||
public int Index
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.index;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400166F RID: 5743
|
||||
private const string defaultMessage = "Failed to decode the input byte sequence to Unicode characters.";
|
||||
|
||||
// Token: 0x04001670 RID: 5744
|
||||
private byte[] bytes_unknown;
|
||||
|
||||
// Token: 0x04001671 RID: 5745
|
||||
private int index;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Provides a failure-handling mechanism, called a fallback, for an encoded input byte sequence that cannot be converted to an output character. The fallback emits a user-specified replacement string instead of a decoded input byte sequence. This class cannot be inherited.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020005E7 RID: 1511
|
||||
[Serializable]
|
||||
public sealed class DecoderReplacementFallback : DecoderFallback
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.DecoderReplacementFallback" /> class. </summary>
|
||||
// Token: 0x060036FD RID: 14077 RVA: 0x000BC85C File Offset: 0x000BAA5C
|
||||
public DecoderReplacementFallback()
|
||||
: this("?")
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.DecoderReplacementFallback" /> class using a specified replacement string.</summary>
|
||||
/// <param name="replacement">A string that is emitted in a decoding operation in place of an input byte sequence that cannot be decoded.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="replacement" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="replacement" /> contains an invalid surrogate pair. In other words, the surrogate pair does not consist of one high surrogate component followed by one low surrogate component.</exception>
|
||||
// Token: 0x060036FE RID: 14078 RVA: 0x000BC86C File Offset: 0x000BAA6C
|
||||
[MonoTODO]
|
||||
public DecoderReplacementFallback(string replacement)
|
||||
{
|
||||
if (replacement == null)
|
||||
{
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
this.replacement = replacement;
|
||||
}
|
||||
|
||||
/// <summary>Gets the replacement string that is the value of the <see cref="T:System.Text.DecoderReplacementFallback" /> object.</summary>
|
||||
/// <returns>A substitute string that is emitted in place of an input byte sequence that cannot be decoded.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AC0 RID: 2752
|
||||
// (get) Token: 0x060036FF RID: 14079 RVA: 0x000BC888 File Offset: 0x000BAA88
|
||||
public string DefaultString
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.replacement;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the number of characters in the replacement string for the <see cref="T:System.Text.DecoderReplacementFallback" /> object.</summary>
|
||||
/// <returns>The number of characters in the string that is emitted in place of a byte sequence that cannot be decoded, that is, the length of the string returned by the <see cref="P:System.Text.DecoderReplacementFallback.DefaultString" /> property.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AC1 RID: 2753
|
||||
// (get) Token: 0x06003700 RID: 14080 RVA: 0x000BC890 File Offset: 0x000BAA90
|
||||
public override int MaxCharCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.replacement.Length;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Text.DecoderFallbackBuffer" /> object that is initialized with the replacement string of this <see cref="T:System.Text.DecoderReplacementFallback" /> object.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.DecoderFallbackBuffer" /> object that specifies a string to use instead of the original decoding operation input.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003701 RID: 14081 RVA: 0x000BC8A0 File Offset: 0x000BAAA0
|
||||
public override DecoderFallbackBuffer CreateFallbackBuffer()
|
||||
{
|
||||
return new DecoderReplacementFallbackBuffer(this);
|
||||
}
|
||||
|
||||
/// <summary>Indicates whether the value of a specified object is equal to the <see cref="T:System.Text.DecoderReplacementFallback" /> object.</summary>
|
||||
/// <returns>true if <paramref name="value" /> is a <see cref="T:System.Text.DecoderReplacementFallback" /> object having a <see cref="P:System.Text.DecoderReplacementFallback.DefaultString" /> property that is equal to the <see cref="P:System.Text.DecoderReplacementFallback.DefaultString" /> property of the current <see cref="T:System.Text.DecoderReplacementFallback" /> object; otherwise, false. </returns>
|
||||
/// <param name="value">A <see cref="T:System.Text.DecoderReplacementFallback" /> object.</param>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003702 RID: 14082 RVA: 0x000BC8A8 File Offset: 0x000BAAA8
|
||||
public override bool Equals(object value)
|
||||
{
|
||||
DecoderReplacementFallback decoderReplacementFallback = value as DecoderReplacementFallback;
|
||||
return decoderReplacementFallback != null && this.replacement == decoderReplacementFallback.replacement;
|
||||
}
|
||||
|
||||
/// <summary>Retrieves the hash code for the value of the <see cref="T:System.Text.DecoderReplacementFallback" /> object.</summary>
|
||||
/// <returns>The hash code of the value of the object.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003703 RID: 14083 RVA: 0x000BC8D8 File Offset: 0x000BAAD8
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return this.replacement.GetHashCode();
|
||||
}
|
||||
|
||||
// Token: 0x04001672 RID: 5746
|
||||
private string replacement;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Represents a substitute output string that is emitted when the original input byte sequence cannot be decoded. This class cannot be inherited.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020005E8 RID: 1512
|
||||
public sealed class DecoderReplacementFallbackBuffer : DecoderFallbackBuffer
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.DecoderReplacementFallbackBuffer" /> class using the value of a <see cref="T:System.Text.DecoderReplacementFallback" /> object.</summary>
|
||||
/// <param name="fallback">A <see cref="T:System.Text.DecoderReplacementFallback" /> object that contains a replacement string. </param>
|
||||
// Token: 0x06003704 RID: 14084 RVA: 0x000BC8E8 File Offset: 0x000BAAE8
|
||||
public DecoderReplacementFallbackBuffer(DecoderReplacementFallback fallback)
|
||||
{
|
||||
if (fallback == null)
|
||||
{
|
||||
throw new ArgumentNullException("fallback");
|
||||
}
|
||||
this.replacement = fallback.DefaultString;
|
||||
this.current = 0;
|
||||
}
|
||||
|
||||
/// <summary>Gets the number of characters in the replacement fallback buffer that remain to be processed.</summary>
|
||||
/// <returns>The number of characters in the replacement fallback buffer that have not yet been processed.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000AC2 RID: 2754
|
||||
// (get) Token: 0x06003705 RID: 14085 RVA: 0x000BC920 File Offset: 0x000BAB20
|
||||
public override int Remaining
|
||||
{
|
||||
get
|
||||
{
|
||||
return (!this.fallback_assigned) ? 0 : (this.replacement.Length - this.current);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Prepares the replacement fallback buffer to use the current replacement string.</summary>
|
||||
/// <returns>true if the replacement string is not empty; false if the replacement string is empty.</returns>
|
||||
/// <param name="bytesUnknown">An input byte sequence. This parameter is ignored unless an exception is thrown.</param>
|
||||
/// <param name="index">The index position of the byte in <paramref name="bytesUnknown" />. This parameter is ignored in this operation.</param>
|
||||
/// <exception cref="T:System.ArgumentException">This method is called again before the <see cref="M:System.Text.DecoderReplacementFallbackBuffer.GetNextChar" /> method has read all the characters in the replacement fallback buffer. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003706 RID: 14086 RVA: 0x000BC948 File Offset: 0x000BAB48
|
||||
public override bool Fallback(byte[] bytesUnknown, int index)
|
||||
{
|
||||
if (bytesUnknown == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytesUnknown");
|
||||
}
|
||||
if (this.fallback_assigned && this.Remaining != 0)
|
||||
{
|
||||
throw new ArgumentException("Reentrant Fallback method invocation occured. It might be because either this FallbackBuffer is incorrectly shared by multiple threads, invoked inside Encoding recursively, or Reset invocation is forgotten.");
|
||||
}
|
||||
if (index < 0 || bytesUnknown.Length < index)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
}
|
||||
this.fallback_assigned = true;
|
||||
this.current = 0;
|
||||
return this.replacement.Length > 0;
|
||||
}
|
||||
|
||||
/// <summary>Retrieves the next character in the replacement fallback buffer.</summary>
|
||||
/// <returns>The next character in the replacement fallback buffer.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003707 RID: 14087 RVA: 0x000BC9C0 File Offset: 0x000BABC0
|
||||
public override char GetNextChar()
|
||||
{
|
||||
if (!this.fallback_assigned)
|
||||
{
|
||||
return '\0';
|
||||
}
|
||||
if (this.current >= this.replacement.Length)
|
||||
{
|
||||
return '\0';
|
||||
}
|
||||
return this.replacement[this.current++];
|
||||
}
|
||||
|
||||
/// <summary>Causes the next call to <see cref="M:System.Text.DecoderReplacementFallbackBuffer.GetNextChar" /> to access the character position in the replacement fallback buffer prior to the current character position.</summary>
|
||||
/// <returns>true if the <see cref="M:System.Text.DecoderReplacementFallbackBuffer.MovePrevious" /> operation was successful; otherwise, false.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003708 RID: 14088 RVA: 0x000BCA10 File Offset: 0x000BAC10
|
||||
public override bool MovePrevious()
|
||||
{
|
||||
if (this.current == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.current--;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Initializes all internal state information and data in the <see cref="T:System.Text.DecoderReplacementFallbackBuffer" /> object.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003709 RID: 14089 RVA: 0x000BCA30 File Offset: 0x000BAC30
|
||||
public override void Reset()
|
||||
{
|
||||
this.fallback_assigned = false;
|
||||
this.current = 0;
|
||||
}
|
||||
|
||||
// Token: 0x04001673 RID: 5747
|
||||
private bool fallback_assigned;
|
||||
|
||||
// Token: 0x04001674 RID: 5748
|
||||
private int current;
|
||||
|
||||
// Token: 0x04001675 RID: 5749
|
||||
private string replacement;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,286 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Converts a set of characters into a sequence of bytes.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x020005E9 RID: 1513
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public abstract class Encoder
|
||||
{
|
||||
/// <summary>Gets or sets a <see cref="T:System.Text.EncoderFallback" /> object for the current <see cref="T:System.Text.Encoder" /> object.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.EncoderFallback" /> object.</returns>
|
||||
/// <exception cref="T:System.ArgumentNullException">The value in a set operation is null (Nothing).</exception>
|
||||
/// <exception cref="T:System.ArgumentException">A new value cannot be assigned in a set operation because the current <see cref="T:System.Text.EncoderFallbackBuffer" /> object contains data that has not been encoded yet. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoder.Fallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000AC3 RID: 2755
|
||||
// (get) Token: 0x0600370B RID: 14091 RVA: 0x000BCA54 File Offset: 0x000BAC54
|
||||
// (set) Token: 0x0600370C RID: 14092 RVA: 0x000BCA5C File Offset: 0x000BAC5C
|
||||
[ComVisible(false)]
|
||||
public EncoderFallback Fallback
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.fallback;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
this.fallback = value;
|
||||
this.fallback_buffer = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the <see cref="T:System.Text.EncoderFallbackBuffer" /> object associated with the current <see cref="T:System.Text.Encoder" /> object.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.EncoderFallbackBuffer" /> object.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000AC4 RID: 2756
|
||||
// (get) Token: 0x0600370D RID: 14093 RVA: 0x000BCA78 File Offset: 0x000BAC78
|
||||
[ComVisible(false)]
|
||||
public EncoderFallbackBuffer FallbackBuffer
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.fallback_buffer == null)
|
||||
{
|
||||
this.fallback_buffer = this.Fallback.CreateFallbackBuffer();
|
||||
}
|
||||
return this.fallback_buffer;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, calculates the number of bytes produced by encoding a set of characters from the specified character array. A parameter indicates whether to clear the internal state of the encoder after the calculation.</summary>
|
||||
/// <returns>The number of bytes produced by encoding the specified characters and any characters in the internal buffer.</returns>
|
||||
/// <param name="chars">The character array containing the set of characters to encode. </param>
|
||||
/// <param name="index">The index of the first character to encode. </param>
|
||||
/// <param name="count">The number of characters to encode. </param>
|
||||
/// <param name="flush">true to simulate clearing the internal state of the encoder after the calculation; otherwise, false. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="chars" />. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoder.Fallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600370E RID: 14094
|
||||
public abstract int GetByteCount(char[] chars, int index, int count, bool flush);
|
||||
|
||||
/// <summary>When overridden in a derived class, encodes a set of characters from the specified character array and any characters in the internal buffer into the specified byte array. A parameter indicates whether to clear the internal state of the encoder after the conversion.</summary>
|
||||
/// <returns>The actual number of bytes written into <paramref name="bytes" />.</returns>
|
||||
/// <param name="chars">The character array containing the set of characters to encode. </param>
|
||||
/// <param name="charIndex">The index of the first character to encode. </param>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <param name="bytes">The byte array to contain the resulting sequence of bytes. </param>
|
||||
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes. </param>
|
||||
/// <param name="flush">true to clear the internal state of the encoder after the conversion; otherwise, false. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null (Nothing).-or- <paramref name="bytes" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charIndex" /> or <paramref name="charCount" /> or <paramref name="byteIndex" /> is less than zero.-or- <paramref name="charIndex" /> and <paramref name="charCount" /> do not denote a valid range in <paramref name="chars" />.-or- <paramref name="byteIndex" /> is not a valid index in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="bytes" /> does not have enough capacity from <paramref name="byteIndex" /> to the end of the array to accommodate the resulting bytes. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoder.Fallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600370F RID: 14095
|
||||
public abstract int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, bool flush);
|
||||
|
||||
/// <summary>When overridden in a derived class, calculates the number of bytes produced by encoding a set of characters starting at the specified character pointer. A parameter indicates whether to clear the internal state of the encoder after the calculation.</summary>
|
||||
/// <returns>The number of bytes produced by encoding the specified characters and any characters in the internal buffer.</returns>
|
||||
/// <param name="chars">A pointer to the first character to encode. </param>
|
||||
/// <param name="count">The number of characters to encode. </param>
|
||||
/// <param name="flush">true to simulate clearing the internal state of the encoder after the calculation; otherwise, false. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null (Nothing in Visual Basic .NET). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="count" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoder.Fallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003710 RID: 14096 RVA: 0x000BCAA8 File Offset: 0x000BACA8
|
||||
[ComVisible(false)]
|
||||
[CLSCompliant(false)]
|
||||
public unsafe virtual int GetByteCount(char* chars, int count, bool flush)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count");
|
||||
}
|
||||
char[] array = new char[count];
|
||||
Marshal.Copy((IntPtr)((void*)chars), array, 0, count);
|
||||
return this.GetByteCount(array, 0, count, flush);
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, encodes a set of characters starting at the specified character pointer and any characters in the internal buffer into a sequence of bytes that are stored starting at the specified byte pointer. A parameter indicates whether to clear the internal state of the encoder after the conversion.</summary>
|
||||
/// <returns>The actual number of bytes written at the location indicated by the <paramref name="bytes" /> parameter.</returns>
|
||||
/// <param name="chars">A pointer to the first character to encode. </param>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <param name="bytes">A pointer to the location at which to start writing the resulting sequence of bytes. </param>
|
||||
/// <param name="byteCount">The maximum number of bytes to write. </param>
|
||||
/// <param name="flush">true to clear the internal state of the encoder after the conversion; otherwise, false. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null (Nothing).-or- <paramref name="bytes" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charCount" /> or <paramref name="byteCount" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="byteCount" /> is less than the resulting number of bytes. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoder.Fallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003711 RID: 14097 RVA: 0x000BCAF8 File Offset: 0x000BACF8
|
||||
[ComVisible(false)]
|
||||
[CLSCompliant(false)]
|
||||
public unsafe virtual int GetBytes(char* chars, int charCount, byte* bytes, int byteCount, bool flush)
|
||||
{
|
||||
this.CheckArguments(chars, charCount, bytes, byteCount);
|
||||
char[] array = new char[charCount];
|
||||
Marshal.Copy((IntPtr)((void*)chars), array, 0, charCount);
|
||||
byte[] array2 = new byte[byteCount];
|
||||
Marshal.Copy((IntPtr)((void*)bytes), array2, 0, byteCount);
|
||||
return this.GetBytes(array, 0, charCount, array2, 0, flush);
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, sets the encoder back to its initial state.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003712 RID: 14098 RVA: 0x000BCB4C File Offset: 0x000BAD4C
|
||||
[ComVisible(false)]
|
||||
public virtual void Reset()
|
||||
{
|
||||
if (this.fallback_buffer != null)
|
||||
{
|
||||
this.fallback_buffer.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Converts a buffer of Unicode characters to an encoded byte sequence and stores the result in another buffer.</summary>
|
||||
/// <param name="chars">The address of a string of UTF-16 encoded characters to convert.</param>
|
||||
/// <param name="charCount">The number of characters in <paramref name="chars" /> to convert.</param>
|
||||
/// <param name="bytes">The address of a buffer to store the converted bytes.</param>
|
||||
/// <param name="byteCount">The maximum number of bytes in <paramref name="bytes" /> to use in the conversion.</param>
|
||||
/// <param name="flush">true to indicate no further data is to be converted; otherwise, false.</param>
|
||||
/// <param name="charsUsed">When this method returns, contains the number of characters from <paramref name="chars" /> that were used in the conversion. This parameter is passed uninitialized.</param>
|
||||
/// <param name="bytesUsed">When this method returns, contains the number of bytes that were used in the conversion. This parameter is passed uninitialized.</param>
|
||||
/// <param name="completed">When this method returns, contains true if all the characters specified by <paramref name="charCount" /> were converted; otherwise, false. This parameter is passed uninitialized.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> or <paramref name="bytes" /> is null (Nothing).</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charCount" /> or <paramref name="byteCount" /> is less than zero.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The output buffer is too small to contain any of the converted input. The output buffer should be greater than or equal to the size indicated by the <see cref="Overload:System.Text.Encoder.GetByteCount" /> method.</exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoder.Fallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003713 RID: 14099 RVA: 0x000BCB64 File Offset: 0x000BAD64
|
||||
[ComVisible(false)]
|
||||
[CLSCompliant(false)]
|
||||
public unsafe virtual void Convert(char* chars, int charCount, byte* bytes, int byteCount, bool flush, out int charsUsed, out int bytesUsed, out bool completed)
|
||||
{
|
||||
this.CheckArguments(chars, charCount, bytes, byteCount);
|
||||
charsUsed = charCount;
|
||||
for (;;)
|
||||
{
|
||||
bytesUsed = this.GetByteCount(chars, charsUsed, flush);
|
||||
if (bytesUsed <= byteCount)
|
||||
{
|
||||
break;
|
||||
}
|
||||
flush = false;
|
||||
charsUsed >>= 1;
|
||||
}
|
||||
completed = charsUsed == charCount;
|
||||
bytesUsed = this.GetBytes(chars, charsUsed, bytes, byteCount, flush);
|
||||
}
|
||||
|
||||
/// <summary>Converts an array of Unicode characters to an encoded byte sequence and stores the result in an array of bytes.</summary>
|
||||
/// <param name="chars">An array of characters to convert.</param>
|
||||
/// <param name="charIndex">The first element of <paramref name="chars" /> to convert.</param>
|
||||
/// <param name="charCount">The number of elements of <paramref name="chars" /> to convert.</param>
|
||||
/// <param name="bytes">An array where the converted bytes are stored.</param>
|
||||
/// <param name="byteIndex">The first element of <paramref name="bytes" /> in which data is stored.</param>
|
||||
/// <param name="byteCount">The maximum number of elements of <paramref name="bytes" /> to use in the conversion.</param>
|
||||
/// <param name="flush">true to indicate no further data is to be converted; otherwise, false.</param>
|
||||
/// <param name="charsUsed">When this method returns, contains the number of characters from <paramref name="chars" /> that were used in the conversion. This parameter is passed uninitialized.</param>
|
||||
/// <param name="bytesUsed">When this method returns, contains the number of bytes that were produced by the conversion. This parameter is passed uninitialized.</param>
|
||||
/// <param name="completed">When this method returns, contains true if all the characters specified by <paramref name="charCount" /> were converted; otherwise, false. This parameter is passed uninitialized.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> or <paramref name="bytes" /> is null (Nothing).</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charIndex" />, <paramref name="charCount" />, <paramref name="byteIndex" />, or <paramref name="byteCount" /> is less than zero.-or-The length of <paramref name="chars" /> - <paramref name="charIndex" /> is less than <paramref name="charCount" />.-or-The length of <paramref name="bytes" /> - <paramref name="byteIndex" /> is less than <paramref name="byteCount" />.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The output buffer is too small to contain any of the converted input. The output buffer should be greater than or equal to the size indicated by the <see cref="Overload:System.Text.Encoder.GetByteCount" /> method.</exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoder.Fallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003714 RID: 14100 RVA: 0x000BCBCC File Offset: 0x000BADCC
|
||||
[ComVisible(false)]
|
||||
public virtual void Convert(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, int byteCount, bool flush, out int charsUsed, out int bytesUsed, out bool completed)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (charIndex < 0 || chars.Length <= charIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex");
|
||||
}
|
||||
if (charCount < 0 || chars.Length < charIndex + charCount)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount");
|
||||
}
|
||||
if (byteIndex < 0 || bytes.Length <= byteIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex");
|
||||
}
|
||||
if (byteCount < 0 || bytes.Length < byteIndex + byteCount)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount");
|
||||
}
|
||||
charsUsed = charCount;
|
||||
for (;;)
|
||||
{
|
||||
bytesUsed = this.GetByteCount(chars, charIndex, charsUsed, flush);
|
||||
if (bytesUsed <= byteCount)
|
||||
{
|
||||
break;
|
||||
}
|
||||
flush = false;
|
||||
charsUsed >>= 1;
|
||||
}
|
||||
completed = charsUsed == charCount;
|
||||
bytesUsed = this.GetBytes(chars, charIndex, charsUsed, bytes, byteIndex, flush);
|
||||
}
|
||||
|
||||
// Token: 0x06003715 RID: 14101 RVA: 0x000BCCC4 File Offset: 0x000BAEC4
|
||||
private unsafe void CheckArguments(char* chars, int charCount, byte* bytes, int byteCount)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (charCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount");
|
||||
}
|
||||
if (byteCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04001676 RID: 5750
|
||||
private EncoderFallback fallback = new EncoderReplacementFallback();
|
||||
|
||||
// Token: 0x04001677 RID: 5751
|
||||
private EncoderFallbackBuffer fallback_buffer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Throws a <see cref="T:System.Text.EncoderFallbackException" /> if an input character cannot be converted to an encoded output byte sequence. This class cannot be inherited.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020005EA RID: 1514
|
||||
[Serializable]
|
||||
public sealed class EncoderExceptionFallback : EncoderFallback
|
||||
{
|
||||
/// <summary>Gets the maximum number of characters this instance can return.</summary>
|
||||
/// <returns>The return value is always zero.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AC5 RID: 2757
|
||||
// (get) Token: 0x06003717 RID: 14103 RVA: 0x000BCD20 File Offset: 0x000BAF20
|
||||
public override int MaxCharCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.EncoderExceptionFallback" /> class.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.EncoderFallbackBuffer" /> object.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003718 RID: 14104 RVA: 0x000BCD24 File Offset: 0x000BAF24
|
||||
public override EncoderFallbackBuffer CreateFallbackBuffer()
|
||||
{
|
||||
return new EncoderExceptionFallbackBuffer();
|
||||
}
|
||||
|
||||
/// <summary>Indicates whether the current <see cref="T:System.Text.EncoderExceptionFallback" /> object and a specified object are equal.</summary>
|
||||
/// <returns>true if <paramref name="value" /> is not null (Nothing in Visual Basic .NET) and is a <see cref="T:System.Text.EncoderExceptionFallback" /> object; otherwise, false.</returns>
|
||||
/// <param name="value">An object that derives from the <see cref="T:System.Text.EncoderExceptionFallback" /> class.</param>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003719 RID: 14105 RVA: 0x000BCD2C File Offset: 0x000BAF2C
|
||||
public override bool Equals(object value)
|
||||
{
|
||||
return value is EncoderExceptionFallback;
|
||||
}
|
||||
|
||||
/// <summary>Retrieves the hash code for this instance.</summary>
|
||||
/// <returns>The return value is always the same arbitrary value, and has no special significance. </returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600371A RID: 14106 RVA: 0x000BCD38 File Offset: 0x000BAF38
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Throws <see cref="T:System.Text.EncoderFallbackException" /> when an input character cannot be converted to an encoded output byte sequence. This class cannot be inherited.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020005EB RID: 1515
|
||||
public sealed class EncoderExceptionFallbackBuffer : EncoderFallbackBuffer
|
||||
{
|
||||
/// <summary>Gets the number of characters in the current <see cref="T:System.Text.EncoderExceptionFallbackBuffer" /> object that remain to be processed.</summary>
|
||||
/// <returns>The return value is always zero.A return value is defined, although it is unchanging, because this method implements an abstract method.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000AC6 RID: 2758
|
||||
// (get) Token: 0x0600371C RID: 14108 RVA: 0x000BCD44 File Offset: 0x000BAF44
|
||||
public override int Remaining
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Throws an exception because the input character cannot be encoded. Parameters specify the value and index position of the character that cannot be converted.</summary>
|
||||
/// <returns>None. No value is returned because the <see cref="M:System.Text.EncoderExceptionFallbackBuffer.Fallback(System.Char,System.Int32)" /> method always throws an exception. </returns>
|
||||
/// <param name="charUnknown">An input character.</param>
|
||||
/// <param name="index">The index position of the character in the input buffer.</param>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">
|
||||
/// <paramref name="charUnknown" /> cannot be encoded. This method always throws an exception that reports the value of the <paramref name="charUnknown" /> and <paramref name="index" /> parameters.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600371D RID: 14109 RVA: 0x000BCD48 File Offset: 0x000BAF48
|
||||
public override bool Fallback(char charUnknown, int index)
|
||||
{
|
||||
throw new EncoderFallbackException(charUnknown, index);
|
||||
}
|
||||
|
||||
/// <summary>Throws an exception because the input character cannot be encoded. Parameters specify the value and index position of the surrogate pair in the input, and the nominal return value is not used.</summary>
|
||||
/// <returns>None. No value is returned because the <see cref="M:System.Text.EncoderExceptionFallbackBuffer.Fallback(System.Char,System.Char,System.Int32)" /> method always throws an exception. </returns>
|
||||
/// <param name="charUnknownHigh">The high surrogate of the input pair.</param>
|
||||
/// <param name="charUnknownLow">The low surrogate of the input pair.</param>
|
||||
/// <param name="index">The index position of the surrogate pair in the input buffer.</param>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">The character represented by <paramref name="charUnknownHigh" /> and <paramref name="charUnknownLow" /> cannot be encoded.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Either <paramref name="charUnknownHigh" /> or <paramref name="charUnknownLow" /> is invalid. <paramref name="charUnknownHigh" /> is not between U+D800 and U+DBFF, inclusive, or <paramref name="charUnknownLow" /> is not between U+DC00 and U+DFFF, inclusive.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600371E RID: 14110 RVA: 0x000BCD54 File Offset: 0x000BAF54
|
||||
public override bool Fallback(char charUnknownHigh, char charUnknownLow, int index)
|
||||
{
|
||||
throw new EncoderFallbackException(charUnknownHigh, charUnknownLow, index);
|
||||
}
|
||||
|
||||
/// <summary>Retrieves the next character in the exception fallback buffer.</summary>
|
||||
/// <returns>The return value is always the Unicode character, NULL (U+0000). A return value is defined, although it is unchanging, because this method implements an abstract method.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600371F RID: 14111 RVA: 0x000BCD60 File Offset: 0x000BAF60
|
||||
public override char GetNextChar()
|
||||
{
|
||||
return '\0';
|
||||
}
|
||||
|
||||
/// <summary>Causes the next call to the <see cref="M:System.Text.EncoderExceptionFallbackBuffer.GetNextChar" /> method to access the exception data buffer character position that is prior to the current position.</summary>
|
||||
/// <returns>The return value is always false.A return value is defined, although it is unchanging, because this method implements an abstract method.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003720 RID: 14112 RVA: 0x000BCD64 File Offset: 0x000BAF64
|
||||
public override bool MovePrevious()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Provides a failure-handling mechanism, called a fallback, for an input character that cannot be converted to an encoded output byte sequence. </summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020005EC RID: 1516
|
||||
[Serializable]
|
||||
public abstract class EncoderFallback
|
||||
{
|
||||
/// <summary>Gets an object that throws an exception when an input character cannot be encoded.</summary>
|
||||
/// <returns>A type derived from the <see cref="T:System.Text.EncoderFallback" /> class. The default value is a <see cref="T:System.Text.EncoderExceptionFallback" /> object.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000AC7 RID: 2759
|
||||
// (get) Token: 0x06003723 RID: 14115 RVA: 0x000BCD98 File Offset: 0x000BAF98
|
||||
public static EncoderFallback ExceptionFallback
|
||||
{
|
||||
get
|
||||
{
|
||||
return EncoderFallback.exception_fallback;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, gets the maximum number of characters the current <see cref="T:System.Text.EncoderFallback" /> object can return.</summary>
|
||||
/// <returns>The maximum number of characters the current <see cref="T:System.Text.EncoderFallback" /> object can return.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AC8 RID: 2760
|
||||
// (get) Token: 0x06003724 RID: 14116
|
||||
public abstract int MaxCharCount { get; }
|
||||
|
||||
/// <summary>Gets an object that outputs a substitute string in place of an input character that cannot be encoded.</summary>
|
||||
/// <returns>A type derived from the <see cref="T:System.Text.EncoderFallback" /> class. The default value is a <see cref="T:System.Text.EncoderReplacementFallback" /> object that replaces unknown input characters with the QUESTION MARK character ("?", U+003F).</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000AC9 RID: 2761
|
||||
// (get) Token: 0x06003725 RID: 14117 RVA: 0x000BCDA0 File Offset: 0x000BAFA0
|
||||
public static EncoderFallback ReplacementFallback
|
||||
{
|
||||
get
|
||||
{
|
||||
return EncoderFallback.replacement_fallback;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000ACA RID: 2762
|
||||
// (get) Token: 0x06003726 RID: 14118 RVA: 0x000BCDA8 File Offset: 0x000BAFA8
|
||||
internal static EncoderFallback StandardSafeFallback
|
||||
{
|
||||
get
|
||||
{
|
||||
return EncoderFallback.standard_safe_fallback;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, initializes a new instance of the <see cref="T:System.Text.EncoderFallbackBuffer" /> class. </summary>
|
||||
/// <returns>An object that provides a fallback buffer for an encoder.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003727 RID: 14119
|
||||
public abstract EncoderFallbackBuffer CreateFallbackBuffer();
|
||||
|
||||
// Token: 0x04001678 RID: 5752
|
||||
private static EncoderFallback exception_fallback = new EncoderExceptionFallback();
|
||||
|
||||
// Token: 0x04001679 RID: 5753
|
||||
private static EncoderFallback replacement_fallback = new EncoderReplacementFallback();
|
||||
|
||||
// Token: 0x0400167A RID: 5754
|
||||
private static EncoderFallback standard_safe_fallback = new EncoderReplacementFallback("\ufffd");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Provides a buffer that allows a fallback handler to return an alternate string to an encoder when it cannot encode an input character. </summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020005ED RID: 1517
|
||||
public abstract class EncoderFallbackBuffer
|
||||
{
|
||||
/// <summary>When overridden in a derived class, gets the number of characters in the current <see cref="T:System.Text.EncoderFallbackBuffer" /> object that remain to be processed.</summary>
|
||||
/// <returns>The number of characters in the current fallback buffer that have not yet been processed.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000ACB RID: 2763
|
||||
// (get) Token: 0x06003729 RID: 14121
|
||||
public abstract int Remaining { get; }
|
||||
|
||||
/// <summary>When overridden in a derived class, prepares the fallback buffer to handle the specified input character. </summary>
|
||||
/// <returns>true if the fallback buffer can process <paramref name="charUnknown" />; false if the fallback buffer ignores <paramref name="charUnknown" />.</returns>
|
||||
/// <param name="charUnknown">An input character.</param>
|
||||
/// <param name="index">The index position of the character in the input buffer.</param>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600372A RID: 14122
|
||||
public abstract bool Fallback(char charUnknown, int index);
|
||||
|
||||
/// <summary>When overridden in a derived class, prepares the fallback buffer to handle the specified surrogate pair.</summary>
|
||||
/// <returns>True if the fallback buffer can process <paramref name="charUnknownHigh" /> and <paramref name="charUnknownLow" />; false if fallback buffer ignores the surrogate pair.</returns>
|
||||
/// <param name="charUnknownHigh">The high surrogate of the input pair.</param>
|
||||
/// <param name="charUnknownLow">The low surrogate of the input pair.</param>
|
||||
/// <param name="index">The index position of the surrogate pair in the input buffer.</param>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600372B RID: 14123
|
||||
public abstract bool Fallback(char charUnknownHigh, char charUnknownLow, int index);
|
||||
|
||||
/// <summary>When overridden in a derived class, retrieves the next character in the fallback buffer.</summary>
|
||||
/// <returns>The next character in the fallback buffer.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600372C RID: 14124
|
||||
public abstract char GetNextChar();
|
||||
|
||||
/// <summary>When overridden in a derived class, causes the next call to the <see cref="M:System.Text.EncoderFallbackBuffer.GetNextChar" /> method to access the data buffer character position that is prior to the current character position. </summary>
|
||||
/// <returns>true if the <see cref="M:System.Text.EncoderFallbackBuffer.MovePrevious" /> operation was successful; otherwise, false.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600372D RID: 14125
|
||||
public abstract bool MovePrevious();
|
||||
|
||||
/// <summary>Initializes all data and state information pertaining to this fallback buffer.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600372E RID: 14126 RVA: 0x000BCDB8 File Offset: 0x000BAFB8
|
||||
public virtual void Reset()
|
||||
{
|
||||
while (this.GetNextChar() != '\0')
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>The exception that is thrown when an encoder fallback operation fails. This class cannot be inherited.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020005EE RID: 1518
|
||||
[Serializable]
|
||||
public sealed class EncoderFallbackException : ArgumentException
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.EncoderFallbackException" /> class.</summary>
|
||||
// Token: 0x0600372F RID: 14127 RVA: 0x000BCDCC File Offset: 0x000BAFCC
|
||||
public EncoderFallbackException()
|
||||
: this(null)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.EncoderFallbackException" /> class. A parameter specifies the error message.</summary>
|
||||
/// <param name="message">An error message.</param>
|
||||
// Token: 0x06003730 RID: 14128 RVA: 0x000BCDD8 File Offset: 0x000BAFD8
|
||||
public EncoderFallbackException(string message)
|
||||
{
|
||||
this.index = -1;
|
||||
base..ctor(message);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.EncoderFallbackException" /> class. Parameters specify the error message and the inner exception that is the cause of this exception.</summary>
|
||||
/// <param name="message">An error message.</param>
|
||||
/// <param name="innerException">The exception that caused this exception.</param>
|
||||
// Token: 0x06003731 RID: 14129 RVA: 0x000BCDE8 File Offset: 0x000BAFE8
|
||||
public EncoderFallbackException(string message, Exception innerException)
|
||||
{
|
||||
this.index = -1;
|
||||
base..ctor(message, innerException);
|
||||
}
|
||||
|
||||
// Token: 0x06003732 RID: 14130 RVA: 0x000BCDFC File Offset: 0x000BAFFC
|
||||
internal EncoderFallbackException(char charUnknown, int index)
|
||||
{
|
||||
this.index = -1;
|
||||
base..ctor(null);
|
||||
this.char_unknown = charUnknown;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
// Token: 0x06003733 RID: 14131 RVA: 0x000BCE1C File Offset: 0x000BB01C
|
||||
internal EncoderFallbackException(char charUnknownHigh, char charUnknownLow, int index)
|
||||
{
|
||||
this.index = -1;
|
||||
base..ctor(null);
|
||||
this.char_unknown_high = charUnknownHigh;
|
||||
this.char_unknown_low = charUnknownLow;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
/// <summary>Gets the input character that caused the exception.</summary>
|
||||
/// <returns>The character that cannot be encoded.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000ACC RID: 2764
|
||||
// (get) Token: 0x06003734 RID: 14132 RVA: 0x000BCE44 File Offset: 0x000BB044
|
||||
public char CharUnknown
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.char_unknown;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the high component character of the surrogate pair that caused the exception.</summary>
|
||||
/// <returns>The high component character of the surrogate pair that cannot be encoded.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000ACD RID: 2765
|
||||
// (get) Token: 0x06003735 RID: 14133 RVA: 0x000BCE4C File Offset: 0x000BB04C
|
||||
public char CharUnknownHigh
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.char_unknown_high;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the low component character of the surrogate pair that caused the exception.</summary>
|
||||
/// <returns>The low component character of the surrogate pair that cannot be encoded.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000ACE RID: 2766
|
||||
// (get) Token: 0x06003736 RID: 14134 RVA: 0x000BCE54 File Offset: 0x000BB054
|
||||
public char CharUnknownLow
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.char_unknown_low;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the index position in the input buffer of the character that caused the exception.</summary>
|
||||
/// <returns>The index position in the input buffer of the character that cannot be encoded.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000ACF RID: 2767
|
||||
// (get) Token: 0x06003737 RID: 14135 RVA: 0x000BCE5C File Offset: 0x000BB05C
|
||||
[MonoTODO]
|
||||
public int Index
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.index;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Indicates whether the input that caused the exception is a surrogate pair.</summary>
|
||||
/// <returns>true if the input was a surrogate pair; otherwise, false.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003738 RID: 14136 RVA: 0x000BCE64 File Offset: 0x000BB064
|
||||
[MonoTODO]
|
||||
public bool IsUnknownSurrogate()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
// Token: 0x0400167B RID: 5755
|
||||
private const string defaultMessage = "Failed to decode the input byte sequence to Unicode characters.";
|
||||
|
||||
// Token: 0x0400167C RID: 5756
|
||||
private char char_unknown;
|
||||
|
||||
// Token: 0x0400167D RID: 5757
|
||||
private char char_unknown_high;
|
||||
|
||||
// Token: 0x0400167E RID: 5758
|
||||
private char char_unknown_low;
|
||||
|
||||
// Token: 0x0400167F RID: 5759
|
||||
private int index;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Provides a failure handling mechanism, called a fallback, for an input character that cannot be converted to an output byte sequence. The fallback uses a user-specified replacement string instead of the original input character. This class cannot be inherited.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020005EF RID: 1519
|
||||
[Serializable]
|
||||
public sealed class EncoderReplacementFallback : EncoderFallback
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.EncoderReplacementFallback" /> class.</summary>
|
||||
// Token: 0x06003739 RID: 14137 RVA: 0x000BCE6C File Offset: 0x000BB06C
|
||||
public EncoderReplacementFallback()
|
||||
: this("?")
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.EncoderReplacementFallback" /> class using a specified replacement string.</summary>
|
||||
/// <param name="replacement">A string that is converted in an encoding operation in place of an input character that cannot be encoded.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="replacement" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="replacement" /> contains an invalid surrogate pair. In other words, the surrogate does not consist of one high surrogate component followed by one low surrogate component.</exception>
|
||||
// Token: 0x0600373A RID: 14138 RVA: 0x000BCE7C File Offset: 0x000BB07C
|
||||
[MonoTODO]
|
||||
public EncoderReplacementFallback(string replacement)
|
||||
{
|
||||
if (replacement == null)
|
||||
{
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
this.replacement = replacement;
|
||||
}
|
||||
|
||||
/// <summary>Gets the replacement string that is the value of the <see cref="T:System.Text.EncoderReplacementFallback" /> object.</summary>
|
||||
/// <returns>A substitute string that is used in place of an input character that cannot be encoded.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AD0 RID: 2768
|
||||
// (get) Token: 0x0600373B RID: 14139 RVA: 0x000BCE98 File Offset: 0x000BB098
|
||||
public string DefaultString
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.replacement;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the number of characters in the replacement string for the <see cref="T:System.Text.EncoderReplacementFallback" /> object.</summary>
|
||||
/// <returns>The number of characters in the string used in place of an input character that cannot be encoded.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AD1 RID: 2769
|
||||
// (get) Token: 0x0600373C RID: 14140 RVA: 0x000BCEA0 File Offset: 0x000BB0A0
|
||||
public override int MaxCharCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.replacement.Length;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Text.EncoderFallbackBuffer" /> object that is initialized with the replacement string of this <see cref="T:System.Text.EncoderReplacementFallback" /> object.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.EncoderFallbackBuffer" /> object equal to this <see cref="T:System.Text.EncoderReplacementFallback" /> object. </returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600373D RID: 14141 RVA: 0x000BCEB0 File Offset: 0x000BB0B0
|
||||
public override EncoderFallbackBuffer CreateFallbackBuffer()
|
||||
{
|
||||
return new EncoderReplacementFallbackBuffer(this);
|
||||
}
|
||||
|
||||
/// <summary>Indicates whether the value of a specified object is equal to the <see cref="T:System.Text.EncoderReplacementFallback" /> object.</summary>
|
||||
/// <returns>true if the <paramref name="value" /> parameter specifies an <see cref="T:System.Text.EncoderReplacementFallback" /> object and the replacement string of that object is equal to the replacement string of this <see cref="T:System.Text.EncoderReplacementFallback" /> object; otherwise, false. </returns>
|
||||
/// <param name="value">A <see cref="T:System.Text.EncoderReplacementFallback" /> object.</param>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600373E RID: 14142 RVA: 0x000BCEB8 File Offset: 0x000BB0B8
|
||||
public override bool Equals(object value)
|
||||
{
|
||||
EncoderReplacementFallback encoderReplacementFallback = value as EncoderReplacementFallback;
|
||||
return encoderReplacementFallback != null && this.replacement == encoderReplacementFallback.replacement;
|
||||
}
|
||||
|
||||
/// <summary>Retrieves the hash code for the value of the <see cref="T:System.Text.EncoderReplacementFallback" /> object.</summary>
|
||||
/// <returns>The hash code of the value of the object.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600373F RID: 14143 RVA: 0x000BCEE8 File Offset: 0x000BB0E8
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return this.replacement.GetHashCode();
|
||||
}
|
||||
|
||||
// Token: 0x04001680 RID: 5760
|
||||
private string replacement;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Represents a substitute input string that is used when the original input character cannot be encoded. This class cannot be inherited.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020005F0 RID: 1520
|
||||
public sealed class EncoderReplacementFallbackBuffer : EncoderFallbackBuffer
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.EncoderReplacementFallbackBuffer" /> class using the value of a <see cref="T:System.Text.EncoderReplacementFallback" /> object.</summary>
|
||||
/// <param name="fallback">A <see cref="T:System.Text.EncoderReplacementFallback" /> object. </param>
|
||||
// Token: 0x06003740 RID: 14144 RVA: 0x000BCEF8 File Offset: 0x000BB0F8
|
||||
public EncoderReplacementFallbackBuffer(EncoderReplacementFallback fallback)
|
||||
{
|
||||
if (fallback == null)
|
||||
{
|
||||
throw new ArgumentNullException("fallback");
|
||||
}
|
||||
this.replacement = fallback.DefaultString;
|
||||
this.current = 0;
|
||||
}
|
||||
|
||||
/// <summary>Gets the number of characters in the replacement fallback buffer that remain to be processed.</summary>
|
||||
/// <returns>The number of characters in the replacement fallback buffer that have not yet been processed.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000AD2 RID: 2770
|
||||
// (get) Token: 0x06003741 RID: 14145 RVA: 0x000BCF30 File Offset: 0x000BB130
|
||||
public override int Remaining
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.replacement.Length - this.current;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Prepares the replacement fallback buffer to use the current replacement string.</summary>
|
||||
/// <returns>true if the replacement string is not empty; false if the replacement string is empty.</returns>
|
||||
/// <param name="charUnknown">An input character. This parameter is ignored in this operation unless an exception is thrown.</param>
|
||||
/// <param name="index">The index position of the character in the input buffer. This parameter is ignored in this operation.</param>
|
||||
/// <exception cref="T:System.ArgumentException">This method is called again before the <see cref="M:System.Text.EncoderReplacementFallbackBuffer.GetNextChar" /> method has read all the characters in the replacement fallback buffer. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003742 RID: 14146 RVA: 0x000BCF44 File Offset: 0x000BB144
|
||||
public override bool Fallback(char charUnknown, int index)
|
||||
{
|
||||
return this.Fallback(index);
|
||||
}
|
||||
|
||||
/// <summary>Indicates whether a replacement string can be used when an input surrogate pair cannot be encoded, or whether the surrogate pair can be ignored. Parameters specify the surrogate pair and the index position of the pair in the input.</summary>
|
||||
/// <returns>true if the replacement string is not empty; false if the replacement string is empty.</returns>
|
||||
/// <param name="charUnknownHigh">The high surrogate of the input pair.</param>
|
||||
/// <param name="charUnknownLow">The low surrogate of the input pair.</param>
|
||||
/// <param name="index">The index position of the surrogate pair in the input buffer.</param>
|
||||
/// <exception cref="T:System.ArgumentException">This method is called again before the <see cref="M:System.Text.EncoderReplacementFallbackBuffer.GetNextChar" /> method has read all the replacement string characters. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The value of <paramref name="charUnknownHigh" /> is less than U+D800 or greater than U+D8FF.-or-The value of <paramref name="charUnknownLow" /> is less than U+DC00 or greater than U+DFFF.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003743 RID: 14147 RVA: 0x000BCF50 File Offset: 0x000BB150
|
||||
public override bool Fallback(char charUnknownHigh, char charUnknownLow, int index)
|
||||
{
|
||||
return this.Fallback(index);
|
||||
}
|
||||
|
||||
// Token: 0x06003744 RID: 14148 RVA: 0x000BCF5C File Offset: 0x000BB15C
|
||||
private bool Fallback(int index)
|
||||
{
|
||||
if (this.fallback_assigned && this.Remaining != 0)
|
||||
{
|
||||
throw new ArgumentException("Reentrant Fallback method invocation occured. It might be because either this FallbackBuffer is incorrectly shared by multiple threads, invoked inside Encoding recursively, or Reset invocation is forgotten.");
|
||||
}
|
||||
if (index < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
}
|
||||
this.fallback_assigned = true;
|
||||
this.current = 0;
|
||||
return this.replacement.Length > 0;
|
||||
}
|
||||
|
||||
/// <summary>Retrieves the next character in the replacement fallback buffer.</summary>
|
||||
/// <returns>The next Unicode character in the replacement fallback buffer that the application can encode.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003745 RID: 14149 RVA: 0x000BCFB8 File Offset: 0x000BB1B8
|
||||
public override char GetNextChar()
|
||||
{
|
||||
if (this.current >= this.replacement.Length)
|
||||
{
|
||||
return '\0';
|
||||
}
|
||||
return this.replacement[this.current++];
|
||||
}
|
||||
|
||||
/// <summary>Causes the next call to the <see cref="M:System.Text.EncoderReplacementFallbackBuffer.GetNextChar" /> method to access the character position in the replacement fallback buffer prior to the current character position. </summary>
|
||||
/// <returns>true if the <see cref="M:System.Text.EncoderReplacementFallbackBuffer.MovePrevious" /> operation was successful; otherwise, false.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003746 RID: 14150 RVA: 0x000BCFFC File Offset: 0x000BB1FC
|
||||
public override bool MovePrevious()
|
||||
{
|
||||
if (this.current == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.current--;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Initializes all internal state information and data in this instance of <see cref="T:System.Text.EncoderReplacementFallbackBuffer" />.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003747 RID: 14151 RVA: 0x000BD01C File Offset: 0x000BB21C
|
||||
public override void Reset()
|
||||
{
|
||||
this.current = 0;
|
||||
}
|
||||
|
||||
// Token: 0x04001681 RID: 5761
|
||||
private string replacement;
|
||||
|
||||
// Token: 0x04001682 RID: 5762
|
||||
private int current;
|
||||
|
||||
// Token: 0x04001683 RID: 5763
|
||||
private bool fallback_assigned;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,1695 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Represents a character encoding.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x020005F1 RID: 1521
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public abstract class Encoding : ICloneable
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.Encoding" /> class.</summary>
|
||||
// Token: 0x06003748 RID: 14152 RVA: 0x000BD028 File Offset: 0x000BB228
|
||||
protected Encoding()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.Encoding" /> class that corresponds to the specified code page.</summary>
|
||||
/// <param name="codePage">The code page identifier of the preferred encoding.-or- 0, to use the default encoding. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="codePage" /> is less than zero. </exception>
|
||||
// Token: 0x06003749 RID: 14153 RVA: 0x000BD038 File Offset: 0x000BB238
|
||||
protected Encoding(int codePage)
|
||||
{
|
||||
this.windows_code_page = codePage;
|
||||
this.codePage = codePage;
|
||||
if (codePage != 1200 && codePage != 1201 && codePage != 12000 && codePage != 12001 && codePage != 65000 && codePage != 65001)
|
||||
{
|
||||
if (codePage != 20127 && codePage != 54936)
|
||||
{
|
||||
this.decoder_fallback = DecoderFallback.ReplacementFallback;
|
||||
this.encoder_fallback = EncoderFallback.ReplacementFallback;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.decoder_fallback = DecoderFallback.ReplacementFallback;
|
||||
this.encoder_fallback = EncoderFallback.ReplacementFallback;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.decoder_fallback = DecoderFallback.StandardSafeFallback;
|
||||
this.encoder_fallback = EncoderFallback.StandardSafeFallback;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600374B RID: 14155 RVA: 0x000BD2DC File Offset: 0x000BB4DC
|
||||
internal static string _(string arg)
|
||||
{
|
||||
return arg;
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, gets a value indicating whether the current encoding is read-only.</summary>
|
||||
/// <returns>true if the current <see cref="T:System.Text.Encoding" /> is read-only; otherwise, false. The default is true.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AD3 RID: 2771
|
||||
// (get) Token: 0x0600374C RID: 14156 RVA: 0x000BD2E0 File Offset: 0x000BB4E0
|
||||
[ComVisible(false)]
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.is_readonly;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, gets a value indicating whether the current encoding uses single-byte code points.</summary>
|
||||
/// <returns>true if the current <see cref="T:System.Text.Encoding" /> uses single-byte code points; otherwise, false.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AD4 RID: 2772
|
||||
// (get) Token: 0x0600374D RID: 14157 RVA: 0x000BD2E8 File Offset: 0x000BB4E8
|
||||
[ComVisible(false)]
|
||||
public virtual bool IsSingleByte
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the <see cref="T:System.Text.DecoderFallback" /> object for the current <see cref="T:System.Text.Encoding" /> object.</summary>
|
||||
/// <returns>The <see cref="T:System.Text.DecoderFallback" /> object for the current <see cref="T:System.Text.Encoding" /> object. </returns>
|
||||
/// <exception cref="T:System.ArgumentNullException">The value in a set operation is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">A value cannot be assigned in a set operation because the current <see cref="T:System.Text.Encoding" /> object is read-only.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AD5 RID: 2773
|
||||
// (get) Token: 0x0600374E RID: 14158 RVA: 0x000BD2EC File Offset: 0x000BB4EC
|
||||
// (set) Token: 0x0600374F RID: 14159 RVA: 0x000BD2F4 File Offset: 0x000BB4F4
|
||||
[ComVisible(false)]
|
||||
public DecoderFallback DecoderFallback
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.decoder_fallback;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this.IsReadOnly)
|
||||
{
|
||||
throw new InvalidOperationException("This Encoding is readonly.");
|
||||
}
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
this.decoder_fallback = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the <see cref="T:System.Text.EncoderFallback" /> object for the current <see cref="T:System.Text.Encoding" /> object.</summary>
|
||||
/// <returns>The <see cref="T:System.Text.EncoderFallback" /> object for the current <see cref="T:System.Text.Encoding" /> object. </returns>
|
||||
/// <exception cref="T:System.ArgumentNullException">The value in a set operation is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">A value cannot be assigned in a set operation because the current <see cref="T:System.Text.Encoding" /> object is read-only.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AD6 RID: 2774
|
||||
// (get) Token: 0x06003750 RID: 14160 RVA: 0x000BD320 File Offset: 0x000BB520
|
||||
// (set) Token: 0x06003751 RID: 14161 RVA: 0x000BD328 File Offset: 0x000BB528
|
||||
[ComVisible(false)]
|
||||
public EncoderFallback EncoderFallback
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.encoder_fallback;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this.IsReadOnly)
|
||||
{
|
||||
throw new InvalidOperationException("This Encoding is readonly.");
|
||||
}
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
this.encoder_fallback = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06003752 RID: 14162 RVA: 0x000BD354 File Offset: 0x000BB554
|
||||
internal void SetFallbackInternal(EncoderFallback e, DecoderFallback d)
|
||||
{
|
||||
if (e != null)
|
||||
{
|
||||
this.encoder_fallback = e;
|
||||
}
|
||||
if (d != null)
|
||||
{
|
||||
this.decoder_fallback = d;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Converts an entire byte array from one encoding to another.</summary>
|
||||
/// <returns>An array of type <see cref="T:System.Byte" /> containing the results of converting <paramref name="bytes" /> from <paramref name="srcEncoding" /> to <paramref name="dstEncoding" />.</returns>
|
||||
/// <param name="srcEncoding">The encoding format of <paramref name="bytes" />. </param>
|
||||
/// <param name="dstEncoding">The target encoding format. </param>
|
||||
/// <param name="bytes"></param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="srcEncoding" /> is null.-or- <paramref name="dstEncoding" /> is null.-or- <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-srcEncoding.<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-dstEncoding.<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003753 RID: 14163 RVA: 0x000BD370 File Offset: 0x000BB570
|
||||
public static byte[] Convert(Encoding srcEncoding, Encoding dstEncoding, byte[] bytes)
|
||||
{
|
||||
if (srcEncoding == null)
|
||||
{
|
||||
throw new ArgumentNullException("srcEncoding");
|
||||
}
|
||||
if (dstEncoding == null)
|
||||
{
|
||||
throw new ArgumentNullException("dstEncoding");
|
||||
}
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
return dstEncoding.GetBytes(srcEncoding.GetChars(bytes, 0, bytes.Length));
|
||||
}
|
||||
|
||||
/// <summary>Converts a range of bytes in a byte array from one encoding to another.</summary>
|
||||
/// <returns>An array of type <see cref="T:System.Byte" /> containing the result of converting a range of bytes in <paramref name="bytes" /> from <paramref name="srcEncoding" /> to <paramref name="dstEncoding" />.</returns>
|
||||
/// <param name="srcEncoding">The encoding of the source array, <paramref name="bytes" />. </param>
|
||||
/// <param name="dstEncoding">The encoding of the output array. </param>
|
||||
/// <param name="bytes">The array of bytes to convert. </param>
|
||||
/// <param name="index">The index of the first element of <paramref name="bytes" /> to convert. </param>
|
||||
/// <param name="count">The number of bytes to convert. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="srcEncoding" /> is null.-or- <paramref name="dstEncoding" /> is null.-or- <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> and <paramref name="count" /> do not specify a valid range in the byte array. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-srcEncoding.<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-dstEncoding.<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003754 RID: 14164 RVA: 0x000BD3C4 File Offset: 0x000BB5C4
|
||||
public static byte[] Convert(Encoding srcEncoding, Encoding dstEncoding, byte[] bytes, int index, int count)
|
||||
{
|
||||
if (srcEncoding == null)
|
||||
{
|
||||
throw new ArgumentNullException("srcEncoding");
|
||||
}
|
||||
if (dstEncoding == null)
|
||||
{
|
||||
throw new ArgumentNullException("dstEncoding");
|
||||
}
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (index < 0 || index > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (count < 0 || bytes.Length - index < count)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
return dstEncoding.GetBytes(srcEncoding.GetChars(bytes, index, count));
|
||||
}
|
||||
|
||||
/// <summary>Determines whether the specified <see cref="T:System.Object" /> is equal to the current instance.</summary>
|
||||
/// <returns>true if <paramref name="value" /> is an instance of <see cref="T:System.Text.Encoding" /> and is equal to the current instance; otherwise, false. </returns>
|
||||
/// <param name="value">The <see cref="T:System.Object" /> to compare with the current instance. </param>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003755 RID: 14165 RVA: 0x000BD464 File Offset: 0x000BB664
|
||||
public override bool Equals(object value)
|
||||
{
|
||||
Encoding encoding = value as Encoding;
|
||||
return encoding != null && (this.codePage == encoding.codePage && this.DecoderFallback.Equals(encoding.DecoderFallback)) && this.EncoderFallback.Equals(encoding.EncoderFallback);
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, calculates the number of bytes produced by encoding a set of characters from the specified character array.</summary>
|
||||
/// <returns>The number of bytes produced by encoding the specified characters.</returns>
|
||||
/// <param name="chars">The character array containing the set of characters to encode. </param>
|
||||
/// <param name="index">The index of the first character to encode. </param>
|
||||
/// <param name="count">The number of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="chars" />. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003756 RID: 14166
|
||||
public abstract int GetByteCount(char[] chars, int index, int count);
|
||||
|
||||
/// <summary>When overridden in a derived class, calculates the number of bytes produced by encoding the characters in the specified string.</summary>
|
||||
/// <returns>The number of bytes produced by encoding the specified characters.</returns>
|
||||
/// <param name="s">The string containing the set of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="s" /> is null. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003757 RID: 14167 RVA: 0x000BD4BC File Offset: 0x000BB6BC
|
||||
public unsafe virtual int GetByteCount(string s)
|
||||
{
|
||||
if (s == null)
|
||||
{
|
||||
throw new ArgumentNullException("s");
|
||||
}
|
||||
if (s.Length == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
fixed (char* ptr = s + RuntimeHelpers.OffsetToStringData / 2)
|
||||
{
|
||||
return this.GetByteCount(ptr, s.Length);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, calculates the number of bytes produced by encoding all the characters in the specified character array.</summary>
|
||||
/// <returns>The number of bytes produced by encoding all the characters in the specified character array.</returns>
|
||||
/// <param name="chars">The character array containing the characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003758 RID: 14168 RVA: 0x000BD500 File Offset: 0x000BB700
|
||||
public virtual int GetByteCount(char[] chars)
|
||||
{
|
||||
if (chars != null)
|
||||
{
|
||||
return this.GetByteCount(chars, 0, chars.Length);
|
||||
}
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, encodes a set of characters from the specified character array into the specified byte array.</summary>
|
||||
/// <returns>The actual number of bytes written into <paramref name="bytes" />.</returns>
|
||||
/// <param name="chars">The character array containing the set of characters to encode. </param>
|
||||
/// <param name="charIndex">The index of the first character to encode. </param>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <param name="bytes">The byte array to contain the resulting sequence of bytes. </param>
|
||||
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null.-or- <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charIndex" /> or <paramref name="charCount" /> or <paramref name="byteIndex" /> is less than zero.-or- <paramref name="charIndex" /> and <paramref name="charCount" /> do not denote a valid range in <paramref name="chars" />.-or- <paramref name="byteIndex" /> is not a valid index in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="bytes" /> does not have enough capacity from <paramref name="byteIndex" /> to the end of the array to accommodate the resulting bytes. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003759 RID: 14169
|
||||
public abstract int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex);
|
||||
|
||||
/// <summary>When overridden in a derived class, encodes a set of characters from the specified string into the specified byte array.</summary>
|
||||
/// <returns>The actual number of bytes written into <paramref name="bytes" />.</returns>
|
||||
/// <param name="s">The string containing the set of characters to encode. </param>
|
||||
/// <param name="charIndex">The index of the first character to encode. </param>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <param name="bytes">The byte array to contain the resulting sequence of bytes. </param>
|
||||
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="s" /> is null.-or- <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charIndex" /> or <paramref name="charCount" /> or <paramref name="byteIndex" /> is less than zero.-or- <paramref name="charIndex" /> and <paramref name="charCount" /> do not denote a valid range in <paramref name="chars" />.-or- <paramref name="byteIndex" /> is not a valid index in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="bytes" /> does not have enough capacity from <paramref name="byteIndex" /> to the end of the array to accommodate the resulting bytes. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600375A RID: 14170 RVA: 0x000BD520 File Offset: 0x000BB720
|
||||
public unsafe virtual int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex)
|
||||
{
|
||||
if (s == null)
|
||||
{
|
||||
throw new ArgumentNullException("s");
|
||||
}
|
||||
if (charIndex < 0 || charIndex > s.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charCount < 0 || charIndex > s.Length - charCount)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charCount == 0 || bytes.Length == byteIndex)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
fixed (char* ptr = s + RuntimeHelpers.OffsetToStringData / 2)
|
||||
{
|
||||
fixed (byte* ptr2 = (ref bytes != null && bytes.Length != 0 ? ref bytes[0] : ref *null))
|
||||
{
|
||||
return this.GetBytes(ptr + charIndex, charCount, ptr2 + byteIndex, bytes.Length - byteIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, encodes all the characters in the specified string into a sequence of bytes.</summary>
|
||||
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
|
||||
/// <param name="s"></param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="s" /> is null. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600375B RID: 14171 RVA: 0x000BD610 File Offset: 0x000BB810
|
||||
public unsafe virtual byte[] GetBytes(string s)
|
||||
{
|
||||
if (s == null)
|
||||
{
|
||||
throw new ArgumentNullException("s");
|
||||
}
|
||||
if (s.Length == 0)
|
||||
{
|
||||
return new byte[0];
|
||||
}
|
||||
int byteCount = this.GetByteCount(s);
|
||||
if (byteCount == 0)
|
||||
{
|
||||
return new byte[0];
|
||||
}
|
||||
fixed (char* ptr = s + RuntimeHelpers.OffsetToStringData / 2)
|
||||
{
|
||||
byte[] array = new byte[byteCount];
|
||||
fixed (byte* ptr2 = (ref array != null && array.Length != 0 ? ref array[0] : ref *null))
|
||||
{
|
||||
this.GetBytes(ptr, s.Length, ptr2, byteCount);
|
||||
return array;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, encodes a set of characters from the specified character array into a sequence of bytes.</summary>
|
||||
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
|
||||
/// <param name="chars">The character array containing the set of characters to encode. </param>
|
||||
/// <param name="index">The index of the first character to encode. </param>
|
||||
/// <param name="count">The number of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="chars" />. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600375C RID: 14172 RVA: 0x000BD698 File Offset: 0x000BB898
|
||||
public virtual byte[] GetBytes(char[] chars, int index, int count)
|
||||
{
|
||||
int byteCount = this.GetByteCount(chars, index, count);
|
||||
byte[] array = new byte[byteCount];
|
||||
this.GetBytes(chars, index, count, array, 0);
|
||||
return array;
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, encodes all the characters in the specified character array into a sequence of bytes.</summary>
|
||||
/// <returns>A byte array containing the results of encoding the specified set of characters.</returns>
|
||||
/// <param name="chars">The character array containing the characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600375D RID: 14173 RVA: 0x000BD6C4 File Offset: 0x000BB8C4
|
||||
public virtual byte[] GetBytes(char[] chars)
|
||||
{
|
||||
int byteCount = this.GetByteCount(chars, 0, chars.Length);
|
||||
byte[] array = new byte[byteCount];
|
||||
this.GetBytes(chars, 0, chars.Length, array, 0);
|
||||
return array;
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.</summary>
|
||||
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <param name="index">The index of the first byte to decode. </param>
|
||||
/// <param name="count">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600375E RID: 14174
|
||||
public abstract int GetCharCount(byte[] bytes, int index, int count);
|
||||
|
||||
/// <summary>When overridden in a derived class, calculates the number of characters produced by decoding all the bytes in the specified byte array.</summary>
|
||||
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600375F RID: 14175 RVA: 0x000BD6F4 File Offset: 0x000BB8F4
|
||||
public virtual int GetCharCount(byte[] bytes)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
return this.GetCharCount(bytes, 0, bytes.Length);
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, decodes a sequence of bytes from the specified byte array into the specified character array.</summary>
|
||||
/// <returns>The actual number of characters written into <paramref name="chars" />.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <param name="byteIndex">The index of the first byte to decode. </param>
|
||||
/// <param name="byteCount">The number of bytes to decode. </param>
|
||||
/// <param name="chars">The character array to contain the resulting set of characters. </param>
|
||||
/// <param name="charIndex">The index at which to start writing the resulting set of characters. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null.-or- <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteIndex" /> or <paramref name="byteCount" /> or <paramref name="charIndex" /> is less than zero.-or- <paramref name="byteindex" /> and <paramref name="byteCount" /> do not denote a valid range in <paramref name="bytes" />.-or- <paramref name="charIndex" /> is not a valid index in <paramref name="chars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="chars" /> does not have enough capacity from <paramref name="charIndex" /> to the end of the array to accommodate the resulting characters. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003760 RID: 14176
|
||||
public abstract int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex);
|
||||
|
||||
/// <summary>When overridden in a derived class, decodes a sequence of bytes from the specified byte array into a set of characters.</summary>
|
||||
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <param name="index">The index of the first byte to decode. </param>
|
||||
/// <param name="count">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003761 RID: 14177 RVA: 0x000BD714 File Offset: 0x000BB914
|
||||
public virtual char[] GetChars(byte[] bytes, int index, int count)
|
||||
{
|
||||
int charCount = this.GetCharCount(bytes, index, count);
|
||||
char[] array = new char[charCount];
|
||||
this.GetChars(bytes, index, count, array, 0);
|
||||
return array;
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, decodes all the bytes in the specified byte array into a set of characters.</summary>
|
||||
/// <returns>A character array containing the results of decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003762 RID: 14178 RVA: 0x000BD740 File Offset: 0x000BB940
|
||||
public virtual char[] GetChars(byte[] bytes)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
int charCount = this.GetCharCount(bytes, 0, bytes.Length);
|
||||
char[] array = new char[charCount];
|
||||
this.GetChars(bytes, 0, bytes.Length, array, 0);
|
||||
return array;
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, obtains a decoder that converts an encoded sequence of bytes into a sequence of characters.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.Decoder" /> that converts an encoded sequence of bytes into a sequence of characters.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003763 RID: 14179 RVA: 0x000BD780 File Offset: 0x000BB980
|
||||
public virtual Decoder GetDecoder()
|
||||
{
|
||||
return new Encoding.ForwardingDecoder(this);
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, obtains an encoder that converts a sequence of Unicode characters into an encoded sequence of bytes.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.Encoder" /> that converts a sequence of Unicode characters into an encoded sequence of bytes.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003764 RID: 14180 RVA: 0x000BD788 File Offset: 0x000BB988
|
||||
public virtual Encoder GetEncoder()
|
||||
{
|
||||
return new Encoding.ForwardingEncoder(this);
|
||||
}
|
||||
|
||||
// Token: 0x06003765 RID: 14181 RVA: 0x000BD790 File Offset: 0x000BB990
|
||||
private static object InvokeI18N(string name, params object[] args)
|
||||
{
|
||||
object obj = Encoding.lockobj;
|
||||
object obj2;
|
||||
lock (obj)
|
||||
{
|
||||
if (Encoding.i18nDisabled)
|
||||
{
|
||||
obj2 = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Encoding.i18nAssembly == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
Encoding.i18nAssembly = Assembly.Load("I18N, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756");
|
||||
}
|
||||
catch (NotImplementedException)
|
||||
{
|
||||
Encoding.i18nDisabled = true;
|
||||
return null;
|
||||
}
|
||||
if (Encoding.i18nAssembly == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (SystemException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Type type;
|
||||
try
|
||||
{
|
||||
type = Encoding.i18nAssembly.GetType("I18N.Common.Manager");
|
||||
}
|
||||
catch (NotImplementedException)
|
||||
{
|
||||
Encoding.i18nDisabled = true;
|
||||
return null;
|
||||
}
|
||||
if (type == null)
|
||||
{
|
||||
obj2 = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
object obj3;
|
||||
try
|
||||
{
|
||||
obj3 = type.InvokeMember("PrimaryManager", BindingFlags.Static | BindingFlags.Public | BindingFlags.GetProperty, null, null, null, null, null, null);
|
||||
if (obj3 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (MissingMethodException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
catch (SecurityException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
catch (NotImplementedException)
|
||||
{
|
||||
Encoding.i18nDisabled = true;
|
||||
return null;
|
||||
}
|
||||
try
|
||||
{
|
||||
obj2 = type.InvokeMember(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null, obj3, args, null, null, null);
|
||||
}
|
||||
catch (MissingMethodException)
|
||||
{
|
||||
obj2 = null;
|
||||
}
|
||||
catch (SecurityException)
|
||||
{
|
||||
obj2 = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return obj2;
|
||||
}
|
||||
|
||||
/// <summary>Returns the encoding associated with the specified code page identifier.</summary>
|
||||
/// <returns>The <see cref="T:System.Text.Encoding" /> associated with the specified code page.</returns>
|
||||
/// <param name="codepage">The code page identifier of the preferred encoding.-or- 0, to use the default encoding. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="codepage" /> is less than zero or greater than 65535. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="codepage" /> is not supported by the underlying platform. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="codepage" /> is not supported by the underlying platform. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003766 RID: 14182 RVA: 0x000BD9BC File Offset: 0x000BBBBC
|
||||
public static Encoding GetEncoding(int codepage)
|
||||
{
|
||||
if (codepage < 0 || codepage > 65535)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("codepage", "Valid values are between 0 and 65535, inclusive.");
|
||||
}
|
||||
int num = codepage;
|
||||
if (num == 1200)
|
||||
{
|
||||
return Encoding.Unicode;
|
||||
}
|
||||
if (num == 1201)
|
||||
{
|
||||
return Encoding.BigEndianUnicode;
|
||||
}
|
||||
if (num == 12000)
|
||||
{
|
||||
return Encoding.UTF32;
|
||||
}
|
||||
if (num == 12001)
|
||||
{
|
||||
return Encoding.BigEndianUTF32;
|
||||
}
|
||||
if (num == 65000)
|
||||
{
|
||||
return Encoding.UTF7;
|
||||
}
|
||||
if (num == 65001)
|
||||
{
|
||||
return Encoding.UTF8;
|
||||
}
|
||||
if (num == 0)
|
||||
{
|
||||
return Encoding.Default;
|
||||
}
|
||||
if (num == 20127)
|
||||
{
|
||||
return Encoding.ASCII;
|
||||
}
|
||||
if (num == 28591)
|
||||
{
|
||||
return Encoding.ISOLatin1;
|
||||
}
|
||||
Encoding encoding = (Encoding)Encoding.InvokeI18N("GetEncoding", new object[] { codepage });
|
||||
if (encoding != null)
|
||||
{
|
||||
encoding.is_readonly = true;
|
||||
return encoding;
|
||||
}
|
||||
string text = "System.Text.CP" + codepage.ToString();
|
||||
Assembly executingAssembly = Assembly.GetExecutingAssembly();
|
||||
Type type = executingAssembly.GetType(text);
|
||||
if (type != null)
|
||||
{
|
||||
encoding = (Encoding)Activator.CreateInstance(type);
|
||||
encoding.is_readonly = true;
|
||||
return encoding;
|
||||
}
|
||||
type = Type.GetType(text);
|
||||
if (type != null)
|
||||
{
|
||||
encoding = (Encoding)Activator.CreateInstance(type);
|
||||
encoding.is_readonly = true;
|
||||
return encoding;
|
||||
}
|
||||
throw new NotSupportedException(string.Format("CodePage {0} not supported", codepage.ToString()));
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, creates a shallow copy of the current <see cref="T:System.Text.Encoding" /> object.</summary>
|
||||
/// <returns>A copy of the current <see cref="T:System.Text.Encoding" /> object.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003767 RID: 14183 RVA: 0x000BDB38 File Offset: 0x000BBD38
|
||||
[ComVisible(false)]
|
||||
public virtual object Clone()
|
||||
{
|
||||
Encoding encoding = (Encoding)base.MemberwiseClone();
|
||||
encoding.is_readonly = false;
|
||||
return encoding;
|
||||
}
|
||||
|
||||
/// <summary>Returns the encoding associated with the specified code page identifier. Parameters specify an error handler for characters that cannot be encoded and byte sequences that cannot be decoded.</summary>
|
||||
/// <returns>The <see cref="T:System.Text.Encoding" /> object associated with the specified code page.</returns>
|
||||
/// <param name="codepage">The code page identifier of the preferred encoding.-or- 0, to use the default encoding. </param>
|
||||
/// <param name="encoderFallback">A <see cref="T:System.Text.EncoderFallback" /> object that provides an error handling procedure when a character cannot be encoded with the current encoding. </param>
|
||||
/// <param name="decoderFallback">A <see cref="T:System.Text.DecoderFallback" /> object that provides an error handling procedure when a byte sequence cannot be decoded with the current encoding. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="codepage" /> is less than zero or greater than 65535. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="codepage" /> is not supported by the underlying platform. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="codepage" /> is not supported by the underlying platform. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003768 RID: 14184 RVA: 0x000BDB5C File Offset: 0x000BBD5C
|
||||
public static Encoding GetEncoding(int codepage, EncoderFallback encoderFallback, DecoderFallback decoderFallback)
|
||||
{
|
||||
if (encoderFallback == null)
|
||||
{
|
||||
throw new ArgumentNullException("encoderFallback");
|
||||
}
|
||||
if (decoderFallback == null)
|
||||
{
|
||||
throw new ArgumentNullException("decoderFallback");
|
||||
}
|
||||
Encoding encoding = Encoding.GetEncoding(codepage).Clone() as Encoding;
|
||||
encoding.is_readonly = false;
|
||||
encoding.encoder_fallback = encoderFallback;
|
||||
encoding.decoder_fallback = decoderFallback;
|
||||
return encoding;
|
||||
}
|
||||
|
||||
/// <summary>Returns the encoding associated with the specified code page name. Parameters specify an error handler for characters that cannot be encoded and byte sequences that cannot be decoded.</summary>
|
||||
/// <returns>The <see cref="T:System.Text.Encoding" /> object associated with the specified code page.</returns>
|
||||
/// <param name="name">The code page name of the preferred encoding. </param>
|
||||
/// <param name="encoderFallback">A <see cref="T:System.Text.EncoderFallback" /> object that provides an error handling procedure when a character cannot be encoded with the current encoding. </param>
|
||||
/// <param name="decoderFallback">A <see cref="T:System.Text.DecoderFallback" /> object that provides an error handling procedure when a byte sequence cannot be decoded with the current encoding. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="name" /> is not a valid code page name.-or- The code page indicated by <paramref name="name" /> is not supported by the underlying platform. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003769 RID: 14185 RVA: 0x000BDBB4 File Offset: 0x000BBDB4
|
||||
public static Encoding GetEncoding(string name, EncoderFallback encoderFallback, DecoderFallback decoderFallback)
|
||||
{
|
||||
if (encoderFallback == null)
|
||||
{
|
||||
throw new ArgumentNullException("encoderFallback");
|
||||
}
|
||||
if (decoderFallback == null)
|
||||
{
|
||||
throw new ArgumentNullException("decoderFallback");
|
||||
}
|
||||
Encoding encoding = Encoding.GetEncoding(name).Clone() as Encoding;
|
||||
encoding.is_readonly = false;
|
||||
encoding.encoder_fallback = encoderFallback;
|
||||
encoding.decoder_fallback = decoderFallback;
|
||||
return encoding;
|
||||
}
|
||||
|
||||
/// <summary>Returns an array containing all encodings.</summary>
|
||||
/// <returns>An array of type <see cref="T:System.Text.EncodingInfo" /> containing all encodings.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600376A RID: 14186 RVA: 0x000BDC0C File Offset: 0x000BBE0C
|
||||
public static EncodingInfo[] GetEncodings()
|
||||
{
|
||||
if (Encoding.encoding_infos == null)
|
||||
{
|
||||
int[] array = new int[]
|
||||
{
|
||||
37, 437, 500, 708, 850, 852, 855, 857, 858, 860,
|
||||
861, 862, 863, 864, 865, 866, 869, 870, 874, 875,
|
||||
932, 936, 949, 950, 1026, 1047, 1140, 1141, 1142, 1143,
|
||||
1144, 1145, 1146, 1147, 1148, 1149, 1200, 1201, 1250, 1251,
|
||||
1252, 1253, 1254, 1255, 1256, 1257, 1258, 10000, 10079, 12000,
|
||||
12001, 20127, 20273, 20277, 20278, 20280, 20284, 20285, 20290, 20297,
|
||||
20420, 20424, 20866, 20871, 21025, 21866, 28591, 28592, 28593, 28594,
|
||||
28595, 28596, 28597, 28598, 28599, 28605, 38598, 50220, 50221, 50222,
|
||||
51932, 51949, 54936, 57002, 57003, 57004, 57005, 57006, 57007, 57008,
|
||||
57009, 57010, 57011, 65000, 65001
|
||||
};
|
||||
Encoding.encoding_infos = new EncodingInfo[array.Length];
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
Encoding.encoding_infos[i] = new EncodingInfo(array[i]);
|
||||
}
|
||||
}
|
||||
return Encoding.encoding_infos;
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the current encoding is always normalized, using the default normalization form.</summary>
|
||||
/// <returns>true if the current <see cref="T:System.Text.Encoding" /> is always normalized; otherwise, false. The default is false.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600376B RID: 14187 RVA: 0x000BDC6C File Offset: 0x000BBE6C
|
||||
[ComVisible(false)]
|
||||
public bool IsAlwaysNormalized()
|
||||
{
|
||||
return this.IsAlwaysNormalized(NormalizationForm.FormC);
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, gets a value indicating whether the current encoding is always normalized, using the specified normalization form.</summary>
|
||||
/// <returns>true if the current <see cref="T:System.Text.Encoding" /> object is always normalized using the specified <see cref="T:System.Text.NormalizationForm" /> value; otherwise, false. The default is false.</returns>
|
||||
/// <param name="form">One of the <see cref="T:System.Text.NormalizationForm" /> values. </param>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600376C RID: 14188 RVA: 0x000BDC78 File Offset: 0x000BBE78
|
||||
[ComVisible(false)]
|
||||
public virtual bool IsAlwaysNormalized(NormalizationForm form)
|
||||
{
|
||||
return form == NormalizationForm.FormC && this is ASCIIEncoding;
|
||||
}
|
||||
|
||||
/// <summary>Returns an encoding associated with the specified code page name.</summary>
|
||||
/// <returns>The <see cref="T:System.Text.Encoding" /> associated with the specified code page.</returns>
|
||||
/// <param name="name">The code page name of the preferred encoding. Any value returned by <see cref="P:System.Text.Encoding.WebName" /> is a valid input. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="name" /> is not a valid code page name.-or- The code page indicated by <paramref name="name" /> is not supported by the underlying platform. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600376D RID: 14189 RVA: 0x000BDC90 File Offset: 0x000BBE90
|
||||
public static Encoding GetEncoding(string name)
|
||||
{
|
||||
if (name == null)
|
||||
{
|
||||
throw new ArgumentNullException("name");
|
||||
}
|
||||
string text = name.ToLowerInvariant().Replace('-', '_');
|
||||
int num = 0;
|
||||
for (int i = 0; i < Encoding.encodings.Length; i++)
|
||||
{
|
||||
object obj = Encoding.encodings[i];
|
||||
if (obj is int)
|
||||
{
|
||||
num = (int)obj;
|
||||
}
|
||||
else if (text == (string)Encoding.encodings[i])
|
||||
{
|
||||
return Encoding.GetEncoding(num);
|
||||
}
|
||||
}
|
||||
Encoding encoding = (Encoding)Encoding.InvokeI18N("GetEncoding", new object[] { name });
|
||||
if (encoding != null)
|
||||
{
|
||||
return encoding;
|
||||
}
|
||||
string text2 = "System.Text.ENC" + text;
|
||||
Assembly executingAssembly = Assembly.GetExecutingAssembly();
|
||||
Type type = executingAssembly.GetType(text2);
|
||||
if (type != null)
|
||||
{
|
||||
return (Encoding)Activator.CreateInstance(type);
|
||||
}
|
||||
type = Type.GetType(text2);
|
||||
if (type != null)
|
||||
{
|
||||
return (Encoding)Activator.CreateInstance(type);
|
||||
}
|
||||
throw new ArgumentException(string.Format("Encoding name '{0}' not supported", name), "name");
|
||||
}
|
||||
|
||||
/// <summary>Returns the hash code for the current instance.</summary>
|
||||
/// <returns>The hash code for the current instance.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600376E RID: 14190 RVA: 0x000BDDA0 File Offset: 0x000BBFA0
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return this.DecoderFallback.GetHashCode() << 24 + this.EncoderFallback.GetHashCode() << 16 + this.codePage;
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, calculates the maximum number of bytes produced by encoding the specified number of characters.</summary>
|
||||
/// <returns>The maximum number of bytes produced by encoding the specified number of characters.</returns>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charCount" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600376F RID: 14191
|
||||
public abstract int GetMaxByteCount(int charCount);
|
||||
|
||||
/// <summary>When overridden in a derived class, calculates the maximum number of characters produced by decoding the specified number of bytes.</summary>
|
||||
/// <returns>The maximum number of characters produced by decoding the specified number of bytes.</returns>
|
||||
/// <param name="byteCount">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteCount" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003770 RID: 14192
|
||||
public abstract int GetMaxCharCount(int byteCount);
|
||||
|
||||
/// <summary>When overridden in a derived class, returns a sequence of bytes that specifies the encoding used.</summary>
|
||||
/// <returns>A byte array containing a sequence of bytes that specifies the encoding used.-or- A byte array of length zero, if a preamble is not required.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003771 RID: 14193 RVA: 0x000BDDD8 File Offset: 0x000BBFD8
|
||||
public virtual byte[] GetPreamble()
|
||||
{
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, decodes a sequence of bytes from the specified byte array into a string.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> containing the results of decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <param name="index">The index of the first byte to decode. </param>
|
||||
/// <param name="count">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003772 RID: 14194 RVA: 0x000BDDE0 File Offset: 0x000BBFE0
|
||||
public virtual string GetString(byte[] bytes, int index, int count)
|
||||
{
|
||||
return new string(this.GetChars(bytes, index, count));
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, decodes all the bytes in the specified byte array into a string.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> containing the results of decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003773 RID: 14195 RVA: 0x000BDDF0 File Offset: 0x000BBFF0
|
||||
public virtual string GetString(byte[] bytes)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
return this.GetString(bytes, 0, bytes.Length);
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, gets a name for the current encoding that can be used with mail agent body tags.</summary>
|
||||
/// <returns>A name for the current <see cref="T:System.Text.Encoding" /> that can be used with mail agent body tags.-or- An empty string (""), if the current <see cref="T:System.Text.Encoding" /> cannot be used.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AD7 RID: 2775
|
||||
// (get) Token: 0x06003774 RID: 14196 RVA: 0x000BDE10 File Offset: 0x000BC010
|
||||
public virtual string BodyName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.body_name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, gets the code page identifier of the current <see cref="T:System.Text.Encoding" />.</summary>
|
||||
/// <returns>The code page identifier of the current <see cref="T:System.Text.Encoding" />.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AD8 RID: 2776
|
||||
// (get) Token: 0x06003775 RID: 14197 RVA: 0x000BDE18 File Offset: 0x000BC018
|
||||
public virtual int CodePage
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.codePage;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, gets the human-readable description of the current encoding.</summary>
|
||||
/// <returns>The human-readable description of the current <see cref="T:System.Text.Encoding" />.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AD9 RID: 2777
|
||||
// (get) Token: 0x06003776 RID: 14198 RVA: 0x000BDE20 File Offset: 0x000BC020
|
||||
public virtual string EncodingName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.encoding_name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, gets a name for the current encoding that can be used with mail agent header tags.</summary>
|
||||
/// <returns>A name for the current <see cref="T:System.Text.Encoding" /> to use with mail agent header tags.-or- An empty string (""), if the current <see cref="T:System.Text.Encoding" /> cannot be used.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000ADA RID: 2778
|
||||
// (get) Token: 0x06003777 RID: 14199 RVA: 0x000BDE28 File Offset: 0x000BC028
|
||||
public virtual string HeaderName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.header_name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, gets a value indicating whether the current encoding can be used by browser clients for displaying content.</summary>
|
||||
/// <returns>true if the current <see cref="T:System.Text.Encoding" /> can be used by browser clients for displaying content; otherwise, false.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000ADB RID: 2779
|
||||
// (get) Token: 0x06003778 RID: 14200 RVA: 0x000BDE30 File Offset: 0x000BC030
|
||||
public virtual bool IsBrowserDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.is_browser_display;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, gets a value indicating whether the current encoding can be used by browser clients for saving content.</summary>
|
||||
/// <returns>true if the current <see cref="T:System.Text.Encoding" /> can be used by browser clients for saving content; otherwise, false.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000ADC RID: 2780
|
||||
// (get) Token: 0x06003779 RID: 14201 RVA: 0x000BDE38 File Offset: 0x000BC038
|
||||
public virtual bool IsBrowserSave
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.is_browser_save;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, gets a value indicating whether the current encoding can be used by mail and news clients for displaying content.</summary>
|
||||
/// <returns>true if the current <see cref="T:System.Text.Encoding" /> can be used by mail and news clients for displaying content; otherwise, false.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000ADD RID: 2781
|
||||
// (get) Token: 0x0600377A RID: 14202 RVA: 0x000BDE40 File Offset: 0x000BC040
|
||||
public virtual bool IsMailNewsDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.is_mail_news_display;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, gets a value indicating whether the current encoding can be used by mail and news clients for saving content.</summary>
|
||||
/// <returns>true if the current <see cref="T:System.Text.Encoding" /> can be used by mail and news clients for saving content; otherwise, false.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000ADE RID: 2782
|
||||
// (get) Token: 0x0600377B RID: 14203 RVA: 0x000BDE48 File Offset: 0x000BC048
|
||||
public virtual bool IsMailNewsSave
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.is_mail_news_save;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, gets the name registered with the Internet Assigned Numbers Authority (IANA) for the current encoding.</summary>
|
||||
/// <returns>The IANA name for the current <see cref="T:System.Text.Encoding" />.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000ADF RID: 2783
|
||||
// (get) Token: 0x0600377C RID: 14204 RVA: 0x000BDE50 File Offset: 0x000BC050
|
||||
public virtual string WebName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.web_name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, gets the Windows operating system code page that most closely corresponds to the current encoding.</summary>
|
||||
/// <returns>The Windows operating system code page that most closely corresponds to the current <see cref="T:System.Text.Encoding" />.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AE0 RID: 2784
|
||||
// (get) Token: 0x0600377D RID: 14205 RVA: 0x000BDE58 File Offset: 0x000BC058
|
||||
public virtual int WindowsCodePage
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.windows_code_page;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets an encoding for the ASCII (7-bit) character set.</summary>
|
||||
/// <returns>An encoding for the ASCII (7-bit) character set.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000AE1 RID: 2785
|
||||
// (get) Token: 0x0600377E RID: 14206 RVA: 0x000BDE60 File Offset: 0x000BC060
|
||||
public static Encoding ASCII
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Encoding.asciiEncoding == null)
|
||||
{
|
||||
object obj = Encoding.lockobj;
|
||||
lock (obj)
|
||||
{
|
||||
if (Encoding.asciiEncoding == null)
|
||||
{
|
||||
Encoding.asciiEncoding = new ASCIIEncoding();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Encoding.asciiEncoding;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets an encoding for the UTF-16 format using the big endian byte order.</summary>
|
||||
/// <returns>An encoding object for the UTF-16 format using the big endian byte order.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000AE2 RID: 2786
|
||||
// (get) Token: 0x0600377F RID: 14207 RVA: 0x000BDECC File Offset: 0x000BC0CC
|
||||
public static Encoding BigEndianUnicode
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Encoding.bigEndianEncoding == null)
|
||||
{
|
||||
object obj = Encoding.lockobj;
|
||||
lock (obj)
|
||||
{
|
||||
if (Encoding.bigEndianEncoding == null)
|
||||
{
|
||||
Encoding.bigEndianEncoding = new UnicodeEncoding(true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Encoding.bigEndianEncoding;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06003780 RID: 14208
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
internal static extern string InternalCodePage(ref int code_page);
|
||||
|
||||
/// <summary>Gets an encoding for the operating system's current ANSI code page.</summary>
|
||||
/// <returns>An encoding for the operating system's current ANSI code page.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000AE3 RID: 2787
|
||||
// (get) Token: 0x06003781 RID: 14209 RVA: 0x000BDF3C File Offset: 0x000BC13C
|
||||
public static Encoding Default
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Encoding.defaultEncoding == null)
|
||||
{
|
||||
object obj = Encoding.lockobj;
|
||||
lock (obj)
|
||||
{
|
||||
if (Encoding.defaultEncoding == null)
|
||||
{
|
||||
int num = 1;
|
||||
string text = Encoding.InternalCodePage(ref num);
|
||||
try
|
||||
{
|
||||
if (num == -1)
|
||||
{
|
||||
Encoding.defaultEncoding = Encoding.GetEncoding(text);
|
||||
}
|
||||
else
|
||||
{
|
||||
num &= 268435455;
|
||||
switch (num)
|
||||
{
|
||||
case 1:
|
||||
num = 20127;
|
||||
break;
|
||||
case 2:
|
||||
num = 65000;
|
||||
break;
|
||||
case 3:
|
||||
num = 65001;
|
||||
break;
|
||||
case 4:
|
||||
num = 1200;
|
||||
break;
|
||||
case 5:
|
||||
num = 1201;
|
||||
break;
|
||||
case 6:
|
||||
num = 28591;
|
||||
break;
|
||||
}
|
||||
Encoding.defaultEncoding = Encoding.GetEncoding(num);
|
||||
}
|
||||
}
|
||||
catch (NotSupportedException)
|
||||
{
|
||||
Encoding.defaultEncoding = Encoding.UTF8Unmarked;
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
Encoding.defaultEncoding = Encoding.UTF8Unmarked;
|
||||
}
|
||||
Encoding.defaultEncoding.is_readonly = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Encoding.defaultEncoding;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000AE4 RID: 2788
|
||||
// (get) Token: 0x06003782 RID: 14210 RVA: 0x000BE0A4 File Offset: 0x000BC2A4
|
||||
private static Encoding ISOLatin1
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Encoding.isoLatin1Encoding == null)
|
||||
{
|
||||
object obj = Encoding.lockobj;
|
||||
lock (obj)
|
||||
{
|
||||
if (Encoding.isoLatin1Encoding == null)
|
||||
{
|
||||
Encoding.isoLatin1Encoding = new Latin1Encoding();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Encoding.isoLatin1Encoding;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets an encoding for the UTF-7 format.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.Encoding" /> for the UTF-7 format.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000AE5 RID: 2789
|
||||
// (get) Token: 0x06003783 RID: 14211 RVA: 0x000BE110 File Offset: 0x000BC310
|
||||
public static Encoding UTF7
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Encoding.utf7Encoding == null)
|
||||
{
|
||||
object obj = Encoding.lockobj;
|
||||
lock (obj)
|
||||
{
|
||||
if (Encoding.utf7Encoding == null)
|
||||
{
|
||||
Encoding.utf7Encoding = new UTF7Encoding();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Encoding.utf7Encoding;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets an encoding for the UTF-8 format.</summary>
|
||||
/// <returns>An encoding for the UTF-8 format.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000AE6 RID: 2790
|
||||
// (get) Token: 0x06003784 RID: 14212 RVA: 0x000BE17C File Offset: 0x000BC37C
|
||||
public static Encoding UTF8
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Encoding.utf8EncodingWithMarkers == null)
|
||||
{
|
||||
object obj = Encoding.lockobj;
|
||||
lock (obj)
|
||||
{
|
||||
if (Encoding.utf8EncodingWithMarkers == null)
|
||||
{
|
||||
Encoding.utf8EncodingWithMarkers = new UTF8Encoding(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Encoding.utf8EncodingWithMarkers;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000AE7 RID: 2791
|
||||
// (get) Token: 0x06003785 RID: 14213 RVA: 0x000BE1EC File Offset: 0x000BC3EC
|
||||
internal static Encoding UTF8Unmarked
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Encoding.utf8EncodingWithoutMarkers == null)
|
||||
{
|
||||
object obj = Encoding.lockobj;
|
||||
lock (obj)
|
||||
{
|
||||
if (Encoding.utf8EncodingWithoutMarkers == null)
|
||||
{
|
||||
Encoding.utf8EncodingWithoutMarkers = new UTF8Encoding(false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Encoding.utf8EncodingWithoutMarkers;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000AE8 RID: 2792
|
||||
// (get) Token: 0x06003786 RID: 14214 RVA: 0x000BE25C File Offset: 0x000BC45C
|
||||
internal static Encoding UTF8UnmarkedUnsafe
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Encoding.utf8EncodingUnsafe == null)
|
||||
{
|
||||
object obj = Encoding.lockobj;
|
||||
lock (obj)
|
||||
{
|
||||
if (Encoding.utf8EncodingUnsafe == null)
|
||||
{
|
||||
Encoding.utf8EncodingUnsafe = new UTF8Encoding(false, false);
|
||||
Encoding.utf8EncodingUnsafe.is_readonly = false;
|
||||
Encoding.utf8EncodingUnsafe.DecoderFallback = new DecoderReplacementFallback(string.Empty);
|
||||
Encoding.utf8EncodingUnsafe.is_readonly = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Encoding.utf8EncodingUnsafe;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets an encoding for the UTF-16 format using the little endian byte order.</summary>
|
||||
/// <returns>An encoding for the UTF-16 format using the little endian byte order.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000AE9 RID: 2793
|
||||
// (get) Token: 0x06003787 RID: 14215 RVA: 0x000BE2FC File Offset: 0x000BC4FC
|
||||
public static Encoding Unicode
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Encoding.unicodeEncoding == null)
|
||||
{
|
||||
object obj = Encoding.lockobj;
|
||||
lock (obj)
|
||||
{
|
||||
if (Encoding.unicodeEncoding == null)
|
||||
{
|
||||
Encoding.unicodeEncoding = new UnicodeEncoding(false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Encoding.unicodeEncoding;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets an encoding for the UTF-32 format using the little endian byte order.</summary>
|
||||
/// <returns>An encoding object for the UTF-32 format using the little endian byte order.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000AEA RID: 2794
|
||||
// (get) Token: 0x06003788 RID: 14216 RVA: 0x000BE36C File Offset: 0x000BC56C
|
||||
public static Encoding UTF32
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Encoding.utf32Encoding == null)
|
||||
{
|
||||
object obj = Encoding.lockobj;
|
||||
lock (obj)
|
||||
{
|
||||
if (Encoding.utf32Encoding == null)
|
||||
{
|
||||
Encoding.utf32Encoding = new UTF32Encoding(false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Encoding.utf32Encoding;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000AEB RID: 2795
|
||||
// (get) Token: 0x06003789 RID: 14217 RVA: 0x000BE3DC File Offset: 0x000BC5DC
|
||||
internal static Encoding BigEndianUTF32
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Encoding.bigEndianUTF32Encoding == null)
|
||||
{
|
||||
object obj = Encoding.lockobj;
|
||||
lock (obj)
|
||||
{
|
||||
if (Encoding.bigEndianUTF32Encoding == null)
|
||||
{
|
||||
Encoding.bigEndianUTF32Encoding = new UTF32Encoding(true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Encoding.bigEndianUTF32Encoding;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, calculates the number of bytes produced by encoding a set of characters starting at the specified character pointer.</summary>
|
||||
/// <returns>The number of bytes produced by encoding the specified characters.</returns>
|
||||
/// <param name="chars">A pointer to the first character to encode. </param>
|
||||
/// <param name="count">The number of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="count" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600378A RID: 14218 RVA: 0x000BE44C File Offset: 0x000BC64C
|
||||
[CLSCompliant(false)]
|
||||
[ComVisible(false)]
|
||||
public unsafe virtual int GetByteCount(char* chars, int count)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count");
|
||||
}
|
||||
char[] array = new char[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
array[i] = chars[i];
|
||||
}
|
||||
return this.GetByteCount(array);
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, calculates the number of characters produced by decoding a sequence of bytes starting at the specified byte pointer.</summary>
|
||||
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">A pointer to the first byte to decode. </param>
|
||||
/// <param name="count">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="count" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600378B RID: 14219 RVA: 0x000BE4A8 File Offset: 0x000BC6A8
|
||||
[ComVisible(false)]
|
||||
[CLSCompliant(false)]
|
||||
public unsafe virtual int GetCharCount(byte* bytes, int count)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count");
|
||||
}
|
||||
byte[] array = new byte[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
array[i] = bytes[i];
|
||||
}
|
||||
return this.GetCharCount(array, 0, count);
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, decodes a sequence of bytes starting at the specified byte pointer into a set of characters that are stored starting at the specified character pointer.</summary>
|
||||
/// <returns>The actual number of characters written at the location indicated by the <paramref name="chars" /> parameter.</returns>
|
||||
/// <param name="bytes">A pointer to the first byte to decode. </param>
|
||||
/// <param name="byteCount">The number of bytes to decode. </param>
|
||||
/// <param name="chars">A pointer to the location at which to start writing the resulting set of characters. </param>
|
||||
/// <param name="charCount">The maximum number of characters to write. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null.-or- <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteCount" /> or <paramref name="charCount" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="charCount" /> is less than the resulting number of characters. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600378C RID: 14220 RVA: 0x000BE504 File Offset: 0x000BC704
|
||||
[CLSCompliant(false)]
|
||||
[ComVisible(false)]
|
||||
public unsafe virtual int GetChars(byte* bytes, int byteCount, char* chars, int charCount)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (charCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount");
|
||||
}
|
||||
if (byteCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount");
|
||||
}
|
||||
byte[] array = new byte[byteCount];
|
||||
for (int i = 0; i < byteCount; i++)
|
||||
{
|
||||
array[i] = bytes[i];
|
||||
}
|
||||
char[] chars2 = this.GetChars(array, 0, byteCount);
|
||||
int num = chars2.Length;
|
||||
if (num > charCount)
|
||||
{
|
||||
throw new ArgumentException("charCount is less than the number of characters produced", "charCount");
|
||||
}
|
||||
for (int j = 0; j < num; j++)
|
||||
{
|
||||
chars[j] = chars2[j];
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, encodes a set of characters starting at the specified character pointer into a sequence of bytes that are stored starting at the specified byte pointer.</summary>
|
||||
/// <returns>The actual number of bytes written at the location indicated by the <paramref name="bytes" /> parameter.</returns>
|
||||
/// <param name="chars">A pointer to the first character to encode. </param>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <param name="bytes">A pointer to the location at which to start writing the resulting sequence of bytes. </param>
|
||||
/// <param name="byteCount">The maximum number of bytes to write. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null.-or- <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charCount" /> or <paramref name="byteCount" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="byteCount" /> is less than the resulting number of bytes. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600378D RID: 14221 RVA: 0x000BE5C0 File Offset: 0x000BC7C0
|
||||
[CLSCompliant(false)]
|
||||
[ComVisible(false)]
|
||||
public unsafe virtual int GetBytes(char* chars, int charCount, byte* bytes, int byteCount)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (charCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount");
|
||||
}
|
||||
if (byteCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount");
|
||||
}
|
||||
char[] array = new char[charCount];
|
||||
for (int i = 0; i < charCount; i++)
|
||||
{
|
||||
array[i] = chars[i];
|
||||
}
|
||||
byte[] bytes2 = this.GetBytes(array, 0, charCount);
|
||||
int num = bytes2.Length;
|
||||
if (num > byteCount)
|
||||
{
|
||||
throw new ArgumentException("byteCount is less that the number of bytes produced", "byteCount");
|
||||
}
|
||||
for (int j = 0; j < num; j++)
|
||||
{
|
||||
bytes[j] = bytes2[j];
|
||||
}
|
||||
return bytes2.Length;
|
||||
}
|
||||
|
||||
// Token: 0x04001684 RID: 5764
|
||||
internal int codePage;
|
||||
|
||||
// Token: 0x04001685 RID: 5765
|
||||
internal int windows_code_page;
|
||||
|
||||
// Token: 0x04001686 RID: 5766
|
||||
private bool is_readonly = true;
|
||||
|
||||
// Token: 0x04001687 RID: 5767
|
||||
private DecoderFallback decoder_fallback;
|
||||
|
||||
// Token: 0x04001688 RID: 5768
|
||||
private EncoderFallback encoder_fallback;
|
||||
|
||||
// Token: 0x04001689 RID: 5769
|
||||
private static Assembly i18nAssembly;
|
||||
|
||||
// Token: 0x0400168A RID: 5770
|
||||
private static bool i18nDisabled;
|
||||
|
||||
// Token: 0x0400168B RID: 5771
|
||||
private static EncodingInfo[] encoding_infos;
|
||||
|
||||
// Token: 0x0400168C RID: 5772
|
||||
private static readonly object[] encodings = new object[]
|
||||
{
|
||||
20127, "ascii", "us_ascii", "us", "ansi_x3.4_1968", "ansi_x3.4_1986", "cp367", "csascii", "ibm367", "iso_ir_6",
|
||||
"iso646_us", "iso_646.irv:1991", 65000, "utf_7", "csunicode11utf7", "unicode_1_1_utf_7", "unicode_2_0_utf_7", "x_unicode_1_1_utf_7", "x_unicode_2_0_utf_7", 65001,
|
||||
"utf_8", "unicode_1_1_utf_8", "unicode_2_0_utf_8", "x_unicode_1_1_utf_8", "x_unicode_2_0_utf_8", 1200, "utf_16", "UTF_16LE", "ucs_2", "unicode",
|
||||
"iso_10646_ucs2", 1201, "unicodefffe", "utf_16be", 12000, "utf_32", "UTF_32LE", "ucs_4", 12001, "UTF_32BE",
|
||||
28591, "iso_8859_1", "latin1"
|
||||
};
|
||||
|
||||
// Token: 0x0400168D RID: 5773
|
||||
internal string body_name;
|
||||
|
||||
// Token: 0x0400168E RID: 5774
|
||||
internal string encoding_name;
|
||||
|
||||
// Token: 0x0400168F RID: 5775
|
||||
internal string header_name;
|
||||
|
||||
// Token: 0x04001690 RID: 5776
|
||||
internal bool is_mail_news_display;
|
||||
|
||||
// Token: 0x04001691 RID: 5777
|
||||
internal bool is_mail_news_save;
|
||||
|
||||
// Token: 0x04001692 RID: 5778
|
||||
internal bool is_browser_save;
|
||||
|
||||
// Token: 0x04001693 RID: 5779
|
||||
internal bool is_browser_display;
|
||||
|
||||
// Token: 0x04001694 RID: 5780
|
||||
internal string web_name;
|
||||
|
||||
// Token: 0x04001695 RID: 5781
|
||||
private static volatile Encoding asciiEncoding;
|
||||
|
||||
// Token: 0x04001696 RID: 5782
|
||||
private static volatile Encoding bigEndianEncoding;
|
||||
|
||||
// Token: 0x04001697 RID: 5783
|
||||
private static volatile Encoding defaultEncoding;
|
||||
|
||||
// Token: 0x04001698 RID: 5784
|
||||
private static volatile Encoding utf7Encoding;
|
||||
|
||||
// Token: 0x04001699 RID: 5785
|
||||
private static volatile Encoding utf8EncodingWithMarkers;
|
||||
|
||||
// Token: 0x0400169A RID: 5786
|
||||
private static volatile Encoding utf8EncodingWithoutMarkers;
|
||||
|
||||
// Token: 0x0400169B RID: 5787
|
||||
private static volatile Encoding unicodeEncoding;
|
||||
|
||||
// Token: 0x0400169C RID: 5788
|
||||
private static volatile Encoding isoLatin1Encoding;
|
||||
|
||||
// Token: 0x0400169D RID: 5789
|
||||
private static volatile Encoding utf8EncodingUnsafe;
|
||||
|
||||
// Token: 0x0400169E RID: 5790
|
||||
private static volatile Encoding utf32Encoding;
|
||||
|
||||
// Token: 0x0400169F RID: 5791
|
||||
private static volatile Encoding bigEndianUTF32Encoding;
|
||||
|
||||
// Token: 0x040016A0 RID: 5792
|
||||
private static readonly object lockobj = new object();
|
||||
|
||||
// Token: 0x020005F2 RID: 1522
|
||||
private sealed class ForwardingDecoder : Decoder
|
||||
{
|
||||
// Token: 0x0600378E RID: 14222 RVA: 0x000BE680 File Offset: 0x000BC880
|
||||
public ForwardingDecoder(Encoding enc)
|
||||
{
|
||||
this.encoding = enc;
|
||||
DecoderFallback decoderFallback = this.encoding.DecoderFallback;
|
||||
if (decoderFallback != null)
|
||||
{
|
||||
base.Fallback = decoderFallback;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600378F RID: 14223 RVA: 0x000BE6B4 File Offset: 0x000BC8B4
|
||||
public override int GetCharCount(byte[] bytes, int index, int count)
|
||||
{
|
||||
return this.encoding.GetCharCount(bytes, index, count);
|
||||
}
|
||||
|
||||
// Token: 0x06003790 RID: 14224 RVA: 0x000BE6C4 File Offset: 0x000BC8C4
|
||||
public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
|
||||
{
|
||||
return this.encoding.GetChars(bytes, byteIndex, byteCount, chars, charIndex);
|
||||
}
|
||||
|
||||
// Token: 0x040016A1 RID: 5793
|
||||
private Encoding encoding;
|
||||
}
|
||||
|
||||
// Token: 0x020005F3 RID: 1523
|
||||
private sealed class ForwardingEncoder : Encoder
|
||||
{
|
||||
// Token: 0x06003791 RID: 14225 RVA: 0x000BE6D8 File Offset: 0x000BC8D8
|
||||
public ForwardingEncoder(Encoding enc)
|
||||
{
|
||||
this.encoding = enc;
|
||||
EncoderFallback encoderFallback = this.encoding.EncoderFallback;
|
||||
if (encoderFallback != null)
|
||||
{
|
||||
base.Fallback = encoderFallback;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06003792 RID: 14226 RVA: 0x000BE70C File Offset: 0x000BC90C
|
||||
public override int GetByteCount(char[] chars, int index, int count, bool flush)
|
||||
{
|
||||
return this.encoding.GetByteCount(chars, index, count);
|
||||
}
|
||||
|
||||
// Token: 0x06003793 RID: 14227 RVA: 0x000BE71C File Offset: 0x000BC91C
|
||||
public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteCount, bool flush)
|
||||
{
|
||||
return this.encoding.GetBytes(chars, charIndex, charCount, bytes, byteCount);
|
||||
}
|
||||
|
||||
// Token: 0x040016A2 RID: 5794
|
||||
private Encoding encoding;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Provides basic information about an encoding.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020005F4 RID: 1524
|
||||
[Serializable]
|
||||
public sealed class EncodingInfo
|
||||
{
|
||||
// Token: 0x06003794 RID: 14228 RVA: 0x000BE730 File Offset: 0x000BC930
|
||||
internal EncodingInfo(int cp)
|
||||
{
|
||||
this.codepage = cp;
|
||||
}
|
||||
|
||||
/// <summary>Gets the code page identifier of the encoding.</summary>
|
||||
/// <returns>The code page identifier of the encoding.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AEC RID: 2796
|
||||
// (get) Token: 0x06003795 RID: 14229 RVA: 0x000BE740 File Offset: 0x000BC940
|
||||
public int CodePage
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.codepage;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the human-readable description of the encoding.</summary>
|
||||
/// <returns>The human-readable description of the encoding.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AED RID: 2797
|
||||
// (get) Token: 0x06003796 RID: 14230 RVA: 0x000BE748 File Offset: 0x000BC948
|
||||
[MonoTODO]
|
||||
public string DisplayName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the name registered with the Internet Assigned Numbers Authority (IANA) for the encoding.</summary>
|
||||
/// <returns>The IANA name for the encoding. For more information about the IANA, see www.iana.org.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AEE RID: 2798
|
||||
// (get) Token: 0x06003797 RID: 14231 RVA: 0x000BE750 File Offset: 0x000BC950
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.encoding == null)
|
||||
{
|
||||
this.encoding = this.GetEncoding();
|
||||
}
|
||||
return this.encoding.WebName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the specified object is equal to the current <see cref="T:System.Text.EncodingInfo" /> object.</summary>
|
||||
/// <returns>true if <paramref name="value" /> is a <see cref="T:System.Text.EncodingInfo" /> object and is equal to the current <see cref="T:System.Text.EncodingInfo" /> object; otherwise, false.</returns>
|
||||
/// <param name="value">An object to compare to the current <see cref="T:System.Text.EncodingInfo" /> object.</param>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003798 RID: 14232 RVA: 0x000BE780 File Offset: 0x000BC980
|
||||
public override bool Equals(object value)
|
||||
{
|
||||
EncodingInfo encodingInfo = value as EncodingInfo;
|
||||
return encodingInfo != null && encodingInfo.codepage == this.codepage;
|
||||
}
|
||||
|
||||
/// <summary>Returns the hash code for the current <see cref="T:System.Text.EncodingInfo" /> object.</summary>
|
||||
/// <returns>A 32-bit signed integer hash code.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003799 RID: 14233 RVA: 0x000BE7AC File Offset: 0x000BC9AC
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return this.codepage;
|
||||
}
|
||||
|
||||
/// <summary>Returns a <see cref="T:System.Text.Encoding" /> object that corresponds to the current <see cref="T:System.Text.EncodingInfo" /> object.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.Encoding" /> object that corresponds to the current <see cref="T:System.Text.EncodingInfo" /> object.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600379A RID: 14234 RVA: 0x000BE7B4 File Offset: 0x000BC9B4
|
||||
public Encoding GetEncoding()
|
||||
{
|
||||
return Encoding.GetEncoding(this.codepage);
|
||||
}
|
||||
|
||||
// Token: 0x040016A3 RID: 5795
|
||||
private readonly int codepage;
|
||||
|
||||
// Token: 0x040016A4 RID: 5796
|
||||
private Encoding encoding;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,416 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
// Token: 0x020005F5 RID: 1525
|
||||
[Serializable]
|
||||
internal class Latin1Encoding : Encoding
|
||||
{
|
||||
// Token: 0x0600379B RID: 14235 RVA: 0x000BE7C4 File Offset: 0x000BC9C4
|
||||
public Latin1Encoding()
|
||||
: base(28591)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x17000AEF RID: 2799
|
||||
// (get) Token: 0x0600379C RID: 14236 RVA: 0x000BE7D4 File Offset: 0x000BC9D4
|
||||
public override bool IsSingleByte
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600379D RID: 14237 RVA: 0x000BE7D8 File Offset: 0x000BC9D8
|
||||
public override bool IsAlwaysNormalized(NormalizationForm form)
|
||||
{
|
||||
return form == NormalizationForm.FormC;
|
||||
}
|
||||
|
||||
// Token: 0x0600379E RID: 14238 RVA: 0x000BE7E0 File Offset: 0x000BC9E0
|
||||
public override int GetByteCount(char[] chars, int index, int count)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (index < 0 || index > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (count < 0 || count > chars.Length - index)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
// Token: 0x0600379F RID: 14239 RVA: 0x000BE84C File Offset: 0x000BCA4C
|
||||
public override int GetByteCount(string s)
|
||||
{
|
||||
if (s == null)
|
||||
{
|
||||
throw new ArgumentNullException("s");
|
||||
}
|
||||
return s.Length;
|
||||
}
|
||||
|
||||
// Token: 0x060037A0 RID: 14240 RVA: 0x000BE868 File Offset: 0x000BCA68
|
||||
public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex)
|
||||
{
|
||||
EncoderFallbackBuffer encoderFallbackBuffer = null;
|
||||
char[] array = null;
|
||||
return this.GetBytes(chars, charIndex, charCount, bytes, byteIndex, ref encoderFallbackBuffer, ref array);
|
||||
}
|
||||
|
||||
// Token: 0x060037A1 RID: 14241 RVA: 0x000BE88C File Offset: 0x000BCA8C
|
||||
private int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, ref EncoderFallbackBuffer buffer, ref char[] fallback_chars)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (charIndex < 0 || charIndex > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charCount < 0 || charCount > chars.Length - charIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (bytes.Length - byteIndex < charCount)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"));
|
||||
}
|
||||
int num = charCount;
|
||||
while (num-- > 0)
|
||||
{
|
||||
char c = chars[charIndex++];
|
||||
if (c < 'Ā')
|
||||
{
|
||||
bytes[byteIndex++] = (byte)c;
|
||||
}
|
||||
else if (c >= '!' && c <= '~')
|
||||
{
|
||||
bytes[byteIndex++] = (byte)(c - 'ﻠ');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
buffer = base.EncoderFallback.CreateFallbackBuffer();
|
||||
}
|
||||
if (char.IsSurrogate(c) && num > 1 && char.IsSurrogate(chars[charIndex]))
|
||||
{
|
||||
buffer.Fallback(c, chars[charIndex], charIndex++ - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer.Fallback(c, charIndex - 1);
|
||||
}
|
||||
if (fallback_chars == null || fallback_chars.Length < buffer.Remaining)
|
||||
{
|
||||
fallback_chars = new char[buffer.Remaining];
|
||||
}
|
||||
for (int i = 0; i < fallback_chars.Length; i++)
|
||||
{
|
||||
fallback_chars[i] = buffer.GetNextChar();
|
||||
}
|
||||
byteIndex += this.GetBytes(fallback_chars, 0, fallback_chars.Length, bytes, byteIndex, ref buffer, ref fallback_chars);
|
||||
}
|
||||
}
|
||||
return charCount;
|
||||
}
|
||||
|
||||
// Token: 0x060037A2 RID: 14242 RVA: 0x000BEA78 File Offset: 0x000BCC78
|
||||
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex)
|
||||
{
|
||||
EncoderFallbackBuffer encoderFallbackBuffer = null;
|
||||
char[] array = null;
|
||||
return this.GetBytes(s, charIndex, charCount, bytes, byteIndex, ref encoderFallbackBuffer, ref array);
|
||||
}
|
||||
|
||||
// Token: 0x060037A3 RID: 14243 RVA: 0x000BEA9C File Offset: 0x000BCC9C
|
||||
private int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex, ref EncoderFallbackBuffer buffer, ref char[] fallback_chars)
|
||||
{
|
||||
if (s == null)
|
||||
{
|
||||
throw new ArgumentNullException("s");
|
||||
}
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (charIndex < 0 || charIndex > s.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex", Encoding._("ArgRange_StringIndex"));
|
||||
}
|
||||
if (charCount < 0 || charCount > s.Length - charIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount", Encoding._("ArgRange_StringRange"));
|
||||
}
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (bytes.Length - byteIndex < charCount)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"));
|
||||
}
|
||||
int num = charCount;
|
||||
while (num-- > 0)
|
||||
{
|
||||
char c = s[charIndex++];
|
||||
if (c < 'Ā')
|
||||
{
|
||||
bytes[byteIndex++] = (byte)c;
|
||||
}
|
||||
else if (c >= '!' && c <= '~')
|
||||
{
|
||||
bytes[byteIndex++] = (byte)(c - 'ﻠ');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
buffer = base.EncoderFallback.CreateFallbackBuffer();
|
||||
}
|
||||
if (char.IsSurrogate(c) && num > 1 && char.IsSurrogate(s[charIndex]))
|
||||
{
|
||||
buffer.Fallback(c, s[charIndex], charIndex++ - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer.Fallback(c, charIndex - 1);
|
||||
}
|
||||
if (fallback_chars == null || fallback_chars.Length < buffer.Remaining)
|
||||
{
|
||||
fallback_chars = new char[buffer.Remaining];
|
||||
}
|
||||
for (int i = 0; i < fallback_chars.Length; i++)
|
||||
{
|
||||
fallback_chars[i] = buffer.GetNextChar();
|
||||
}
|
||||
byteIndex += this.GetBytes(fallback_chars, 0, fallback_chars.Length, bytes, byteIndex, ref buffer, ref fallback_chars);
|
||||
}
|
||||
}
|
||||
return charCount;
|
||||
}
|
||||
|
||||
// Token: 0x060037A4 RID: 14244 RVA: 0x000BEC9C File Offset: 0x000BCE9C
|
||||
public override int GetCharCount(byte[] bytes, int index, int count)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (index < 0 || index > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (count < 0 || count > bytes.Length - index)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
// Token: 0x060037A5 RID: 14245 RVA: 0x000BED08 File Offset: 0x000BCF08
|
||||
public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (byteCount < 0 || byteCount > bytes.Length - byteIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charIndex < 0 || charIndex > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (chars.Length - charIndex < byteCount)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"));
|
||||
}
|
||||
int num = byteCount;
|
||||
while (num-- > 0)
|
||||
{
|
||||
chars[charIndex++] = (char)bytes[byteIndex++];
|
||||
}
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
// Token: 0x060037A6 RID: 14246 RVA: 0x000BEDF0 File Offset: 0x000BCFF0
|
||||
public override int GetMaxByteCount(int charCount)
|
||||
{
|
||||
if (charCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount", Encoding._("ArgRange_NonNegative"));
|
||||
}
|
||||
return charCount;
|
||||
}
|
||||
|
||||
// Token: 0x060037A7 RID: 14247 RVA: 0x000BEE10 File Offset: 0x000BD010
|
||||
public override int GetMaxCharCount(int byteCount)
|
||||
{
|
||||
if (byteCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount", Encoding._("ArgRange_NonNegative"));
|
||||
}
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
// Token: 0x060037A8 RID: 14248 RVA: 0x000BEE30 File Offset: 0x000BD030
|
||||
public unsafe override string GetString(byte[] bytes, int index, int count)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (index < 0 || index > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (count < 0 || count > bytes.Length - index)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (count == 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
fixed (byte* ptr = (ref bytes != null && bytes.Length != 0 ? ref bytes[0] : ref *null))
|
||||
{
|
||||
string text = string.InternalAllocateStr(count);
|
||||
fixed (string text2 = text)
|
||||
{
|
||||
fixed (char* ptr2 = text2 + RuntimeHelpers.OffsetToStringData / 2)
|
||||
{
|
||||
byte* ptr3 = ptr + index;
|
||||
byte* ptr4 = ptr3 + count;
|
||||
char* ptr5 = ptr2;
|
||||
while (ptr3 < ptr4)
|
||||
{
|
||||
*(ptr5++) = (char)(*(ptr3++));
|
||||
}
|
||||
text2 = null;
|
||||
return text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060037A9 RID: 14249 RVA: 0x000BEF08 File Offset: 0x000BD108
|
||||
public override string GetString(byte[] bytes)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
return this.GetString(bytes, 0, bytes.Length);
|
||||
}
|
||||
|
||||
// Token: 0x17000AF0 RID: 2800
|
||||
// (get) Token: 0x060037AA RID: 14250 RVA: 0x000BEF28 File Offset: 0x000BD128
|
||||
public override string BodyName
|
||||
{
|
||||
get
|
||||
{
|
||||
return "iso-8859-1";
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000AF1 RID: 2801
|
||||
// (get) Token: 0x060037AB RID: 14251 RVA: 0x000BEF30 File Offset: 0x000BD130
|
||||
public override string EncodingName
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Western European (ISO)";
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000AF2 RID: 2802
|
||||
// (get) Token: 0x060037AC RID: 14252 RVA: 0x000BEF38 File Offset: 0x000BD138
|
||||
public override string HeaderName
|
||||
{
|
||||
get
|
||||
{
|
||||
return "iso-8859-1";
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000AF3 RID: 2803
|
||||
// (get) Token: 0x060037AD RID: 14253 RVA: 0x000BEF40 File Offset: 0x000BD140
|
||||
public override bool IsBrowserDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000AF4 RID: 2804
|
||||
// (get) Token: 0x060037AE RID: 14254 RVA: 0x000BEF44 File Offset: 0x000BD144
|
||||
public override bool IsBrowserSave
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000AF5 RID: 2805
|
||||
// (get) Token: 0x060037AF RID: 14255 RVA: 0x000BEF48 File Offset: 0x000BD148
|
||||
public override bool IsMailNewsDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000AF6 RID: 2806
|
||||
// (get) Token: 0x060037B0 RID: 14256 RVA: 0x000BEF4C File Offset: 0x000BD14C
|
||||
public override bool IsMailNewsSave
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000AF7 RID: 2807
|
||||
// (get) Token: 0x060037B1 RID: 14257 RVA: 0x000BEF50 File Offset: 0x000BD150
|
||||
public override string WebName
|
||||
{
|
||||
get
|
||||
{
|
||||
return "iso-8859-1";
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040016A5 RID: 5797
|
||||
internal const int ISOLATIN_CODE_PAGE = 28591;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Represents a code page encoding.</summary>
|
||||
// Token: 0x020005F6 RID: 1526
|
||||
[Serializable]
|
||||
internal sealed class MLangCodePageEncoding : ISerializable, IObjectReference
|
||||
{
|
||||
// Token: 0x060037B2 RID: 14258 RVA: 0x000BEF58 File Offset: 0x000BD158
|
||||
private MLangCodePageEncoding(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
if (info == null)
|
||||
{
|
||||
throw new ArgumentNullException("info");
|
||||
}
|
||||
this.codePage = (int)info.GetValue("m_codePage", typeof(int));
|
||||
try
|
||||
{
|
||||
this.isReadOnly = (bool)info.GetValue("m_isReadOnly", typeof(bool));
|
||||
this.encoderFallback = (EncoderFallback)info.GetValue("encoderFallback", typeof(EncoderFallback));
|
||||
this.decoderFallback = (DecoderFallback)info.GetValue("decoderFallback", typeof(DecoderFallback));
|
||||
}
|
||||
catch (SerializationException)
|
||||
{
|
||||
this.isReadOnly = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060037B3 RID: 14259 RVA: 0x000BF02C File Offset: 0x000BD22C
|
||||
public void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
throw new ArgumentException("This class cannot be serialized.");
|
||||
}
|
||||
|
||||
// Token: 0x060037B4 RID: 14260 RVA: 0x000BF038 File Offset: 0x000BD238
|
||||
public object GetRealObject(StreamingContext context)
|
||||
{
|
||||
if (this.realObject == null)
|
||||
{
|
||||
Encoding encoding = Encoding.GetEncoding(this.codePage);
|
||||
if (!this.isReadOnly)
|
||||
{
|
||||
encoding = (Encoding)encoding.Clone();
|
||||
encoding.EncoderFallback = this.encoderFallback;
|
||||
encoding.DecoderFallback = this.decoderFallback;
|
||||
}
|
||||
this.realObject = encoding;
|
||||
}
|
||||
return this.realObject;
|
||||
}
|
||||
|
||||
// Token: 0x040016A6 RID: 5798
|
||||
private int codePage;
|
||||
|
||||
// Token: 0x040016A7 RID: 5799
|
||||
private bool isReadOnly;
|
||||
|
||||
// Token: 0x040016A8 RID: 5800
|
||||
private EncoderFallback encoderFallback;
|
||||
|
||||
// Token: 0x040016A9 RID: 5801
|
||||
private DecoderFallback decoderFallback;
|
||||
|
||||
// Token: 0x040016AA RID: 5802
|
||||
private Encoding realObject;
|
||||
|
||||
// Token: 0x020005F7 RID: 1527
|
||||
[Serializable]
|
||||
private sealed class MLangEncoder : ISerializable, IObjectReference
|
||||
{
|
||||
// Token: 0x060037B5 RID: 14261 RVA: 0x000BF098 File Offset: 0x000BD298
|
||||
private MLangEncoder(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
if (info == null)
|
||||
{
|
||||
throw new ArgumentNullException("info");
|
||||
}
|
||||
this.encoding = (Encoding)info.GetValue("m_encoding", typeof(Encoding));
|
||||
}
|
||||
|
||||
// Token: 0x060037B6 RID: 14262 RVA: 0x000BF0D4 File Offset: 0x000BD2D4
|
||||
public void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
throw new ArgumentException("This class cannot be serialized.");
|
||||
}
|
||||
|
||||
// Token: 0x060037B7 RID: 14263 RVA: 0x000BF0E0 File Offset: 0x000BD2E0
|
||||
public object GetRealObject(StreamingContext context)
|
||||
{
|
||||
if (this.realObject == null)
|
||||
{
|
||||
this.realObject = this.encoding.GetEncoder();
|
||||
}
|
||||
return this.realObject;
|
||||
}
|
||||
|
||||
// Token: 0x040016AB RID: 5803
|
||||
private Encoding encoding;
|
||||
|
||||
// Token: 0x040016AC RID: 5804
|
||||
private Encoder realObject;
|
||||
}
|
||||
|
||||
// Token: 0x020005F8 RID: 1528
|
||||
[Serializable]
|
||||
private sealed class MLangDecoder : ISerializable, IObjectReference
|
||||
{
|
||||
// Token: 0x060037B8 RID: 14264 RVA: 0x000BF110 File Offset: 0x000BD310
|
||||
private MLangDecoder(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
if (info == null)
|
||||
{
|
||||
throw new ArgumentNullException("info");
|
||||
}
|
||||
this.encoding = (Encoding)info.GetValue("m_encoding", typeof(Encoding));
|
||||
}
|
||||
|
||||
// Token: 0x060037B9 RID: 14265 RVA: 0x000BF14C File Offset: 0x000BD34C
|
||||
public void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
throw new ArgumentException("This class cannot be serialized.");
|
||||
}
|
||||
|
||||
// Token: 0x060037BA RID: 14266 RVA: 0x000BF158 File Offset: 0x000BD358
|
||||
public object GetRealObject(StreamingContext context)
|
||||
{
|
||||
if (this.realObject == null)
|
||||
{
|
||||
this.realObject = this.encoding.GetDecoder();
|
||||
}
|
||||
return this.realObject;
|
||||
}
|
||||
|
||||
// Token: 0x040016AD RID: 5805
|
||||
private Encoding encoding;
|
||||
|
||||
// Token: 0x040016AE RID: 5806
|
||||
private Decoder realObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Defines the type of normalization to perform.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020005F9 RID: 1529
|
||||
[ComVisible(true)]
|
||||
public enum NormalizationForm
|
||||
{
|
||||
/// <summary>Indicates that a Unicode string is normalized using full canonical decomposition, followed by the replacement of sequences with their primary composites, if possible.</summary>
|
||||
// Token: 0x040016B0 RID: 5808
|
||||
FormC = 1,
|
||||
/// <summary>Indicates that a Unicode string is normalized using full canonical decomposition.</summary>
|
||||
// Token: 0x040016B1 RID: 5809
|
||||
FormD,
|
||||
/// <summary>Indicates that a Unicode string is normalized using full compatibility decomposition, followed by the replacement of sequences with their primary composites, if possible.</summary>
|
||||
// Token: 0x040016B2 RID: 5810
|
||||
FormKC = 5,
|
||||
/// <summary>Indicates that a Unicode string is normalized using full compatibility decomposition.</summary>
|
||||
// Token: 0x040016B3 RID: 5811
|
||||
FormKD
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,1283 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Represents a mutable string of characters. This class cannot be inherited.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x020005FA RID: 1530
|
||||
[ComVisible(true)]
|
||||
[MonoTODO("Serialization format not compatible with .NET")]
|
||||
[Serializable]
|
||||
public sealed class StringBuilder : ISerializable
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.StringBuilder" /> class from the specified substring and capacity.</summary>
|
||||
/// <param name="value">The string that contains the substring used to initialize the value of this instance. If <paramref name="value" /> is null, the new <see cref="T:System.Text.StringBuilder" /> will contain 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 substring 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.StringBuilder" />. </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 <paramref name="value" />. </exception>
|
||||
// Token: 0x060037BB RID: 14267 RVA: 0x000BF188 File Offset: 0x000BD388
|
||||
public StringBuilder(string value, int startIndex, int length, int capacity)
|
||||
: this(value, startIndex, length, capacity, int.MaxValue)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x060037BC RID: 14268 RVA: 0x000BF19C File Offset: 0x000BD39C
|
||||
private StringBuilder(string value, int startIndex, int length, int capacity, int maxCapacity)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
value = string.Empty;
|
||||
}
|
||||
if (startIndex < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("startIndex", startIndex, "StartIndex cannot be less than zero.");
|
||||
}
|
||||
if (length < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("length", length, "Length cannot be less than zero.");
|
||||
}
|
||||
if (capacity < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("capacity", capacity, "capacity must be greater than zero.");
|
||||
}
|
||||
if (maxCapacity < 1)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("maxCapacity", "maxCapacity is less than one.");
|
||||
}
|
||||
if (capacity > maxCapacity)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("capacity", "Capacity exceeds maximum capacity.");
|
||||
}
|
||||
if (startIndex > value.Length - length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("startIndex", startIndex, "StartIndex and length must refer to a location within the string.");
|
||||
}
|
||||
if (capacity == 0)
|
||||
{
|
||||
if (maxCapacity > 16)
|
||||
{
|
||||
capacity = 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._str = (this._cached_str = string.Empty);
|
||||
}
|
||||
}
|
||||
this._maxCapacity = maxCapacity;
|
||||
if (this._str == null)
|
||||
{
|
||||
this._str = string.InternalAllocateStr((length <= capacity) ? capacity : length);
|
||||
}
|
||||
if (length > 0)
|
||||
{
|
||||
string.CharCopy(this._str, 0, value, startIndex, length);
|
||||
}
|
||||
this._length = length;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.StringBuilder" /> class.</summary>
|
||||
// Token: 0x060037BD RID: 14269 RVA: 0x000BF2E4 File Offset: 0x000BD4E4
|
||||
public StringBuilder()
|
||||
: this(null)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.StringBuilder" /> class using 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: 0x060037BE RID: 14270 RVA: 0x000BF2F0 File Offset: 0x000BD4F0
|
||||
public StringBuilder(int capacity)
|
||||
: this(string.Empty, 0, 0, capacity)
|
||||
{
|
||||
}
|
||||
|
||||
/// <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.StringBuilder" />. </param>
|
||||
/// <param name="maxCapacity">The maximum number of characters the current string can contain. </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: 0x060037BF RID: 14271 RVA: 0x000BF300 File Offset: 0x000BD500
|
||||
public StringBuilder(int capacity, int maxCapacity)
|
||||
: this(string.Empty, 0, 0, capacity, maxCapacity)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.StringBuilder" /> class using 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 (that is, it contains <see cref="F:System.String.Empty" />). </param>
|
||||
// Token: 0x060037C0 RID: 14272 RVA: 0x000BF314 File Offset: 0x000BD514
|
||||
public StringBuilder(string value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
value = string.Empty;
|
||||
}
|
||||
this._length = value.Length;
|
||||
this._str = (this._cached_str = value);
|
||||
this._maxCapacity = int.MaxValue;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.StringBuilder" /> class using 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 (that is, it contains <see cref="F:System.String.Empty" />). </param>
|
||||
/// <param name="capacity">The suggested starting size of the <see cref="T:System.Text.StringBuilder" />. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="capacity" /> is less than zero. </exception>
|
||||
// Token: 0x060037C1 RID: 14273 RVA: 0x000BF35C File Offset: 0x000BD55C
|
||||
public StringBuilder(string value, int capacity)
|
||||
: this((value != null) ? value : string.Empty, 0, (value != null) ? value.Length : 0, capacity)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x060037C2 RID: 14274 RVA: 0x000BF394 File Offset: 0x000BD594
|
||||
private StringBuilder(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
string text = info.GetString("m_StringValue");
|
||||
if (text == null)
|
||||
{
|
||||
text = string.Empty;
|
||||
}
|
||||
this._length = text.Length;
|
||||
this._str = (this._cached_str = text);
|
||||
this._maxCapacity = info.GetInt32("m_MaxCapacity");
|
||||
if (this._maxCapacity < 0)
|
||||
{
|
||||
this._maxCapacity = int.MaxValue;
|
||||
}
|
||||
this.Capacity = info.GetInt32("Capacity");
|
||||
}
|
||||
|
||||
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object with the data necessary to deserialize the current <see cref="T:System.Text.StringBuilder" /> object.</summary>
|
||||
/// <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: 0x060037C3 RID: 14275 RVA: 0x000BF414 File Offset: 0x000BD614
|
||||
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
info.AddValue("m_MaxCapacity", this._maxCapacity);
|
||||
info.AddValue("Capacity", this.Capacity);
|
||||
info.AddValue("m_StringValue", this.ToString());
|
||||
info.AddValue("m_currentThread", 0);
|
||||
}
|
||||
|
||||
/// <summary>Gets the maximum capacity of this instance.</summary>
|
||||
/// <returns>The maximum number of characters this instance can hold.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AF8 RID: 2808
|
||||
// (get) Token: 0x060037C4 RID: 14276 RVA: 0x000BF460 File Offset: 0x000BD660
|
||||
public int MaxCapacity
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._maxCapacity;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the maximum number of characters that can be contained in the memory allocated by the current instance.</summary>
|
||||
/// <returns>The maximum number of characters that can be contained in the memory allocated by the current instance.</returns>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified for a set operation is less than the current length of this instance.-or- The value specified for a set operation is greater than the maximum capacity. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AF9 RID: 2809
|
||||
// (get) Token: 0x060037C5 RID: 14277 RVA: 0x000BF468 File Offset: 0x000BD668
|
||||
// (set) Token: 0x060037C6 RID: 14278 RVA: 0x000BF494 File Offset: 0x000BD694
|
||||
public int Capacity
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._str.Length == 0)
|
||||
{
|
||||
return Math.Min(this._maxCapacity, 16);
|
||||
}
|
||||
return this._str.Length;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < this._length)
|
||||
{
|
||||
throw new ArgumentException("Capacity must be larger than length");
|
||||
}
|
||||
if (value > this._maxCapacity)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value", "Should be less than or equal to MaxCapacity");
|
||||
}
|
||||
this.InternalEnsureCapacity(value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the length of the current <see cref="T:System.Text.StringBuilder" /> object.</summary>
|
||||
/// <returns>The length of this instance.</returns>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified for a set operation is less than zero or greater than <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000AFA RID: 2810
|
||||
// (get) Token: 0x060037C7 RID: 14279 RVA: 0x000BF4DC File Offset: 0x000BD6DC
|
||||
// (set) Token: 0x060037C8 RID: 14280 RVA: 0x000BF4E4 File Offset: 0x000BD6E4
|
||||
public int Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._length;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 0 || value > this._maxCapacity)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
if (value == this._length)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (value < this._length)
|
||||
{
|
||||
this.InternalEnsureCapacity(value);
|
||||
this._length = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Append('\0', value - this._length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the character at the specified character position in this instance.</summary>
|
||||
/// <returns>The Unicode character at position <paramref name="index" />.</returns>
|
||||
/// <param name="index">The position of the character. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> is outside the bounds of this instance while setting a character. </exception>
|
||||
/// <exception cref="T:System.IndexOutOfRangeException">
|
||||
/// <paramref name="index" /> is outside the bounds of this instance while getting a character. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000AFB RID: 2811
|
||||
[IndexerName("Chars")]
|
||||
public char this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (index >= this._length || index < 0)
|
||||
{
|
||||
throw new IndexOutOfRangeException();
|
||||
}
|
||||
return this._str[index];
|
||||
}
|
||||
set
|
||||
{
|
||||
if (index >= this._length || index < 0)
|
||||
{
|
||||
throw new IndexOutOfRangeException();
|
||||
}
|
||||
if (this._cached_str != null)
|
||||
{
|
||||
this.InternalEnsureCapacity(this._length);
|
||||
}
|
||||
this._str.InternalSetChar(index, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <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>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037CB RID: 14283 RVA: 0x000BF5B0 File Offset: 0x000BD7B0
|
||||
public override string ToString()
|
||||
{
|
||||
if (this._length == 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
if (this._cached_str != null)
|
||||
{
|
||||
return this._cached_str;
|
||||
}
|
||||
if (this._length < this._str.Length >> 1)
|
||||
{
|
||||
this._cached_str = this._str.SubstringUnchecked(0, this._length);
|
||||
return this._cached_str;
|
||||
}
|
||||
this._cached_str = this._str;
|
||||
this._str.InternalSetLength(this._length);
|
||||
return this._str;
|
||||
}
|
||||
|
||||
/// <summary>Converts the value of a substring of this instance to a <see cref="T:System.String" />.</summary>
|
||||
/// <returns>A string whose value is the same as the specified substring of this instance.</returns>
|
||||
/// <param name="startIndex">The starting position of the substring in this instance. </param>
|
||||
/// <param name="length">The length of the substring. </param>
|
||||
/// <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 length of the current instance. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037CC RID: 14284 RVA: 0x000BF63C File Offset: 0x000BD83C
|
||||
public string ToString(int startIndex, int length)
|
||||
{
|
||||
if (startIndex < 0 || length < 0 || startIndex > this._length - length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
if (startIndex == 0 && length == this._length)
|
||||
{
|
||||
return this.ToString();
|
||||
}
|
||||
return this._str.SubstringUnchecked(startIndex, length);
|
||||
}
|
||||
|
||||
/// <summary>Ensures that the capacity of this instance of <see cref="T:System.Text.StringBuilder" /> is at least the specified value.</summary>
|
||||
/// <returns>The new capacity of this instance.</returns>
|
||||
/// <param name="capacity">The minimum capacity to ensure. </param>
|
||||
/// <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.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060037CD RID: 14285 RVA: 0x000BF694 File Offset: 0x000BD894
|
||||
public int EnsureCapacity(int capacity)
|
||||
{
|
||||
if (capacity < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("Capacity must be greater than 0.");
|
||||
}
|
||||
if (capacity <= this._str.Length)
|
||||
{
|
||||
return this._str.Length;
|
||||
}
|
||||
this.InternalEnsureCapacity(capacity);
|
||||
return this._str.Length;
|
||||
}
|
||||
|
||||
/// <summary>Returns a value indicating whether this instance is equal to a specified object.</summary>
|
||||
/// <returns>true if this instance and <paramref name="sb" /> have equal string, <see cref="P:System.Text.StringBuilder.Capacity" />, and <see cref="P:System.Text.StringBuilder.MaxCapacity" /> values; otherwise, false.</returns>
|
||||
/// <param name="sb">An object to compare with this instance or null. </param>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060037CE RID: 14286 RVA: 0x000BF6E4 File Offset: 0x000BD8E4
|
||||
public bool Equals(StringBuilder sb)
|
||||
{
|
||||
return sb != null && (this._length == sb.Length && this._str == sb._str);
|
||||
}
|
||||
|
||||
/// <summary>Removes the specified range of characters from this instance.</summary>
|
||||
/// <returns>A reference to this instance after the excise operation has completed.</returns>
|
||||
/// <param name="startIndex">The zero-based position in this instance where removal begins. </param>
|
||||
/// <param name="length">The number of characters to remove. </param>
|
||||
/// <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>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037CF RID: 14287 RVA: 0x000BF724 File Offset: 0x000BD924
|
||||
public StringBuilder Remove(int startIndex, int length)
|
||||
{
|
||||
if (startIndex < 0 || length < 0 || startIndex > this._length - length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
if (this._cached_str != null)
|
||||
{
|
||||
this.InternalEnsureCapacity(this._length);
|
||||
}
|
||||
if (this._length - (startIndex + length) > 0)
|
||||
{
|
||||
string.CharCopy(this._str, startIndex, this._str, startIndex + length, this._length - (startIndex + length));
|
||||
}
|
||||
this._length -= length;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Replaces all occurrences of a specified character in this instance with another specified character.</summary>
|
||||
/// <returns>A reference to this instance with <paramref name="oldChar" /> replaced by <paramref name="newChar" />.</returns>
|
||||
/// <param name="oldChar">The character to replace. </param>
|
||||
/// <param name="newChar">The character that replaces <paramref name="oldChar" />. </param>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037D0 RID: 14288 RVA: 0x000BF7A8 File Offset: 0x000BD9A8
|
||||
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>
|
||||
/// <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="startIndex" /> + <paramref name="count" /> -1.</returns>
|
||||
/// <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>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="startIndex" /> + <paramref name="count" /> is greater than the length of the value of this instance.-or- <paramref name="startIndex" /> or <paramref name="count" /> is less than zero. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037D1 RID: 14289 RVA: 0x000BF7BC File Offset: 0x000BD9BC
|
||||
public StringBuilder Replace(char oldChar, char newChar, int startIndex, int count)
|
||||
{
|
||||
if (startIndex > this._length - count || startIndex < 0 || count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
if (this._cached_str != null)
|
||||
{
|
||||
this.InternalEnsureCapacity(this._str.Length);
|
||||
}
|
||||
for (int i = startIndex; i < startIndex + count; i++)
|
||||
{
|
||||
if (this._str[i] == oldChar)
|
||||
{
|
||||
this._str.InternalSetChar(i, newChar);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Replaces all occurrences of a specified string in this instance with another specified string.</summary>
|
||||
/// <returns>A reference to this instance with all instances of <paramref name="oldValue" /> replaced by <paramref name="newValue" />.</returns>
|
||||
/// <param name="oldValue">The string to replace. </param>
|
||||
/// <param name="newValue">The string that replaces <paramref name="oldValue" />, or null. </param>
|
||||
/// <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>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037D2 RID: 14290 RVA: 0x000BF840 File Offset: 0x000BDA40
|
||||
public StringBuilder Replace(string oldValue, string newValue)
|
||||
{
|
||||
return this.Replace(oldValue, newValue, 0, this._length);
|
||||
}
|
||||
|
||||
/// <summary>Replaces, within a substring of this instance, all occurrences of a specified string with another specified string.</summary>
|
||||
/// <returns>A reference to this instance with all instances of <paramref name="oldValue" /> replaced by <paramref name="newValue" /> in the range from <paramref name="startIndex" /> to <paramref name="startIndex" /> + <paramref name="count" /> - 1.</returns>
|
||||
/// <param name="oldValue">The string to replace. </param>
|
||||
/// <param name="newValue">The string that replaces <paramref name="oldValue" />, or null. </param>
|
||||
/// <param name="startIndex">The position in this instance where the substring begins. </param>
|
||||
/// <param name="count">The length of the substring. </param>
|
||||
/// <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.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037D3 RID: 14291 RVA: 0x000BF854 File Offset: 0x000BDA54
|
||||
public StringBuilder Replace(string oldValue, string newValue, int startIndex, int count)
|
||||
{
|
||||
if (oldValue == null)
|
||||
{
|
||||
throw new ArgumentNullException("The old value cannot be null.");
|
||||
}
|
||||
if (startIndex < 0 || count < 0 || startIndex > this._length - count)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
if (oldValue.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("The old value cannot be zero length.");
|
||||
}
|
||||
string text = this._str.Substring(startIndex, count);
|
||||
string text2 = text.Replace(oldValue, newValue);
|
||||
if (text2 == text)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
this.InternalEnsureCapacity(text2.Length + (this._length - count));
|
||||
if (text2.Length < count)
|
||||
{
|
||||
string.CharCopy(this._str, startIndex + text2.Length, this._str, startIndex + count, this._length - startIndex - count);
|
||||
}
|
||||
else if (text2.Length > count)
|
||||
{
|
||||
string.CharCopyReverse(this._str, startIndex + text2.Length, this._str, startIndex + count, this._length - startIndex - count);
|
||||
}
|
||||
string.CharCopy(this._str, startIndex, text2, 0, text2.Length);
|
||||
this._length = text2.Length + (this._length - count);
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Appends the string representation of the Unicode characters in a specified array to the end of this instance.</summary>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
/// <param name="value">The array of characters to append. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037D4 RID: 14292 RVA: 0x000BF980 File Offset: 0x000BDB80
|
||||
public StringBuilder Append(char[] value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
int num = this._length + value.Length;
|
||||
if (this._cached_str != null || this._str.Length < num)
|
||||
{
|
||||
this.InternalEnsureCapacity(num);
|
||||
}
|
||||
string.CharCopy(this._str, this._length, value, 0, value.Length);
|
||||
this._length = num;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Appends a copy of the specified string to the end of this instance.</summary>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
/// <param name="value">The string to append. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037D5 RID: 14293 RVA: 0x000BF9E4 File Offset: 0x000BDBE4
|
||||
public StringBuilder Append(string value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
if (this._length == 0 && value.Length < this._maxCapacity && value.Length > this._str.Length)
|
||||
{
|
||||
this._length = value.Length;
|
||||
this._cached_str = value;
|
||||
this._str = value;
|
||||
return this;
|
||||
}
|
||||
int num = this._length + value.Length;
|
||||
if (this._cached_str != null || this._str.Length < num)
|
||||
{
|
||||
this.InternalEnsureCapacity(num);
|
||||
}
|
||||
string.CharCopy(this._str, this._length, value, 0, value.Length);
|
||||
this._length = num;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Appends the string representation of a specified Boolean value to the end of this instance.</summary>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
/// <param name="value">The Boolean value to append. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037D6 RID: 14294 RVA: 0x000BFA9C File Offset: 0x000BDC9C
|
||||
public StringBuilder Append(bool value)
|
||||
{
|
||||
return this.Append(value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Appends the string representation of a specified 8-bit unsigned integer to the end of this instance.</summary>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
/// <param name="value">The value to append. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037D7 RID: 14295 RVA: 0x000BFAAC File Offset: 0x000BDCAC
|
||||
public StringBuilder Append(byte value)
|
||||
{
|
||||
return this.Append(value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Appends the string representation of a specified decimal number to the end of this instance.</summary>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
/// <param name="value">The value to append. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037D8 RID: 14296 RVA: 0x000BFABC File Offset: 0x000BDCBC
|
||||
public StringBuilder Append(decimal value)
|
||||
{
|
||||
return this.Append(value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Appends the string representation of a specified double-precision floating-point number to the end of this instance.</summary>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
/// <param name="value">The value to append. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037D9 RID: 14297 RVA: 0x000BFACC File Offset: 0x000BDCCC
|
||||
public StringBuilder Append(double value)
|
||||
{
|
||||
return this.Append(value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Appends the string representation of a specified 16-bit signed integer to the end of this instance.</summary>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
/// <param name="value">The value to append. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037DA RID: 14298 RVA: 0x000BFADC File Offset: 0x000BDCDC
|
||||
public StringBuilder Append(short value)
|
||||
{
|
||||
return this.Append(value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Appends the string representation of a specified 32-bit signed integer to the end of this instance.</summary>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
/// <param name="value">The value to append. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037DB RID: 14299 RVA: 0x000BFAEC File Offset: 0x000BDCEC
|
||||
public StringBuilder Append(int value)
|
||||
{
|
||||
return this.Append(value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Appends the string representation of a specified 64-bit signed integer to the end of this instance.</summary>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
/// <param name="value">The value to append. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037DC RID: 14300 RVA: 0x000BFAFC File Offset: 0x000BDCFC
|
||||
public StringBuilder Append(long value)
|
||||
{
|
||||
return this.Append(value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Appends the string representation of a specified object to the end of this instance.</summary>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
/// <param name="value">The object to append. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037DD RID: 14301 RVA: 0x000BFB0C File Offset: 0x000BDD0C
|
||||
public StringBuilder Append(object value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
return this.Append(value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Appends the string representation of a specified 8-bit signed integer to the end of this instance.</summary>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
/// <param name="value">The value to append. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037DE RID: 14302 RVA: 0x000BFB24 File Offset: 0x000BDD24
|
||||
[CLSCompliant(false)]
|
||||
public StringBuilder Append(sbyte value)
|
||||
{
|
||||
return this.Append(value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Appends the string representation of a specified single-precision floating-point number to the end of this instance.</summary>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
/// <param name="value">The value to append. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037DF RID: 14303 RVA: 0x000BFB34 File Offset: 0x000BDD34
|
||||
public StringBuilder Append(float value)
|
||||
{
|
||||
return this.Append(value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Appends the string representation of a specified 16-bit unsigned integer to the end of this instance.</summary>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
/// <param name="value">The value to append. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037E0 RID: 14304 RVA: 0x000BFB44 File Offset: 0x000BDD44
|
||||
[CLSCompliant(false)]
|
||||
public StringBuilder Append(ushort value)
|
||||
{
|
||||
return this.Append(value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Appends the string representation of a specified 32-bit unsigned integer to the end of this instance.</summary>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
/// <param name="value">The value to append. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037E1 RID: 14305 RVA: 0x000BFB54 File Offset: 0x000BDD54
|
||||
[CLSCompliant(false)]
|
||||
public StringBuilder Append(uint value)
|
||||
{
|
||||
return this.Append(value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Appends the string representation of a specified 64-bit unsigned integer to the end of this instance.</summary>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
/// <param name="value">The value to append. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037E2 RID: 14306 RVA: 0x000BFB64 File Offset: 0x000BDD64
|
||||
[CLSCompliant(false)]
|
||||
public StringBuilder Append(ulong value)
|
||||
{
|
||||
return this.Append(value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Appends the string representation of a specified Unicode character to the end of this instance.</summary>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
/// <param name="value">The Unicode character to append. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037E3 RID: 14307 RVA: 0x000BFB74 File Offset: 0x000BDD74
|
||||
public StringBuilder Append(char value)
|
||||
{
|
||||
int num = this._length + 1;
|
||||
if (this._cached_str != null || this._str.Length < num)
|
||||
{
|
||||
this.InternalEnsureCapacity(num);
|
||||
}
|
||||
this._str.InternalSetChar(this._length, value);
|
||||
this._length = num;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Appends a specified number of copies of the string representation of a Unicode character to the end of this instance.</summary>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
/// <param name="value">The character to append. </param>
|
||||
/// <param name="repeatCount">The number of times to append <paramref name="value" />. </param>
|
||||
/// <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.MaxCapacity" />. </exception>
|
||||
/// <exception cref="T:System.OutOfMemoryException">Out of memory.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037E4 RID: 14308 RVA: 0x000BFBC8 File Offset: 0x000BDDC8
|
||||
public StringBuilder Append(char value, int repeatCount)
|
||||
{
|
||||
if (repeatCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
this.InternalEnsureCapacity(this._length + repeatCount);
|
||||
for (int i = 0; i < repeatCount; i++)
|
||||
{
|
||||
this._str.InternalSetChar(this._length++, value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Appends the string representation of a specified subarray of Unicode characters to the end of this instance.</summary>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
/// <param name="value">A character array. </param>
|
||||
/// <param name="startIndex">The zero-based starting position in <paramref name="value" />. </param>
|
||||
/// <param name="charCount">The number of characters to append. </param>
|
||||
/// <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 <paramref name="value" />.-or- Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037E5 RID: 14309 RVA: 0x000BFC20 File Offset: 0x000BDE20
|
||||
public StringBuilder Append(char[] value, int startIndex, int charCount)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
if (startIndex != 0 || charCount != 0)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (charCount < 0 || startIndex < 0 || startIndex > value.Length - charCount)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
int num = this._length + charCount;
|
||||
this.InternalEnsureCapacity(num);
|
||||
string.CharCopy(this._str, this._length, value, startIndex, charCount);
|
||||
this._length = num;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Appends a copy of a specified substring to the end of this instance.</summary>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
/// <param name="value">The string that contains the substring to append. </param>
|
||||
/// <param name="startIndex">The zero-based starting position of the substring within <paramref name="value" />. </param>
|
||||
/// <param name="count">The number of characters in <paramref name="value" /> to append. </param>
|
||||
/// <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 <paramref name="value" />.-or- Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037E6 RID: 14310 RVA: 0x000BFC98 File Offset: 0x000BDE98
|
||||
public StringBuilder Append(string value, int startIndex, int count)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
if (startIndex != 0 && count != 0)
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (count < 0 || startIndex < 0 || startIndex > value.Length - count)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
int num = this._length + count;
|
||||
if (this._cached_str != null || this._str.Length < num)
|
||||
{
|
||||
this.InternalEnsureCapacity(num);
|
||||
}
|
||||
string.CharCopy(this._str, this._length, value, startIndex, count);
|
||||
this._length = num;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Appends the default line terminator to the end of the current <see cref="T:System.Text.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>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037E7 RID: 14311 RVA: 0x000BFD30 File Offset: 0x000BDF30
|
||||
[ComVisible(false)]
|
||||
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>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
/// <param name="value">The <see cref="T:System.String" /> to append. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037E8 RID: 14312 RVA: 0x000BFD40 File Offset: 0x000BDF40
|
||||
[ComVisible(false)]
|
||||
public StringBuilder AppendLine(string value)
|
||||
{
|
||||
return this.Append(value).Append(Environment.NewLine);
|
||||
}
|
||||
|
||||
/// <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>
|
||||
/// <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 object argument.</returns>
|
||||
/// <param name="format">A composite format string (see Remarks). </param>
|
||||
/// <param name="args">An array of objects to format. </param>
|
||||
/// <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 name="args" /> array.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of the expanded string would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060037E9 RID: 14313 RVA: 0x000BFD54 File Offset: 0x000BDF54
|
||||
public StringBuilder AppendFormat(string format, params object[] args)
|
||||
{
|
||||
return this.AppendFormat(null, format, 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 corresponding argument in a parameter array using a specified format provider.</summary>
|
||||
/// <returns>A reference to this instance after the append operation has completed. After the append operation, this instance contains any data that existed before the operation, suffixed by a copy of <paramref name="format" />, where each format item is replaced by the string representation of the corresponding object argument. </returns>
|
||||
/// <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>
|
||||
/// <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 name="args" /> array. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of the expanded string would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060037EA RID: 14314 RVA: 0x000BFD60 File Offset: 0x000BDF60
|
||||
public StringBuilder AppendFormat(IFormatProvider provider, string format, params object[] args)
|
||||
{
|
||||
string.FormatHelper(this, provider, format, args);
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <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>
|
||||
/// <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>
|
||||
/// <param name="format">A composite format string (see Remarks). </param>
|
||||
/// <param name="arg0">An object to format. </param>
|
||||
/// <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>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060037EB RID: 14315 RVA: 0x000BFD70 File Offset: 0x000BDF70
|
||||
public StringBuilder AppendFormat(string format, object arg0)
|
||||
{
|
||||
return this.AppendFormat(null, format, new object[] { 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>
|
||||
/// <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 object argument.</returns>
|
||||
/// <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>
|
||||
/// <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>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060037EC RID: 14316 RVA: 0x000BFD84 File Offset: 0x000BDF84
|
||||
public StringBuilder AppendFormat(string format, object arg0, object arg1)
|
||||
{
|
||||
return this.AppendFormat(null, format, new object[] { 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>
|
||||
/// <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 object argument.</returns>
|
||||
/// <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>
|
||||
/// <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>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060037ED RID: 14317 RVA: 0x000BFD9C File Offset: 0x000BDF9C
|
||||
public StringBuilder AppendFormat(string format, object arg0, object arg1, object arg2)
|
||||
{
|
||||
return this.AppendFormat(null, format, new object[] { arg0, arg1, arg2 });
|
||||
}
|
||||
|
||||
/// <summary>Inserts the string representation of a specified array of Unicode characters into this instance at the specified character position.</summary>
|
||||
/// <returns>A reference to this instance after the insert operation has completed.</returns>
|
||||
/// <param name="index">The position in this instance where insertion begins. </param>
|
||||
/// <param name="value">The character array to insert. </param>
|
||||
/// <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.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037EE RID: 14318 RVA: 0x000BFDBC File Offset: 0x000BDFBC
|
||||
public StringBuilder Insert(int index, char[] value)
|
||||
{
|
||||
return this.Insert(index, new string(value));
|
||||
}
|
||||
|
||||
/// <summary>Inserts a string into this instance at the specified character position.</summary>
|
||||
/// <returns>A reference to this instance after the insert operation has completed.</returns>
|
||||
/// <param name="index">The position in this instance where insertion begins. </param>
|
||||
/// <param name="value">The string to insert. </param>
|
||||
/// <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>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037EF RID: 14319 RVA: 0x000BFDCC File Offset: 0x000BDFCC
|
||||
public StringBuilder Insert(int index, string value)
|
||||
{
|
||||
if (index > this._length || index < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
if (value == null || value.Length == 0)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
this.InternalEnsureCapacity(this._length + value.Length);
|
||||
string.CharCopyReverse(this._str, index + value.Length, this._str, index, this._length - index);
|
||||
string.CharCopy(this._str, index, value, 0, value.Length);
|
||||
this._length += value.Length;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Inserts the string representation of a Boolean value into this instance at the specified character position.</summary>
|
||||
/// <returns>A reference to this instance after the insert operation has completed.</returns>
|
||||
/// <param name="index">The position in this instance where insertion begins. </param>
|
||||
/// <param name="value">The value to insert. </param>
|
||||
/// <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.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037F0 RID: 14320 RVA: 0x000BFE64 File Offset: 0x000BE064
|
||||
public StringBuilder Insert(int index, bool value)
|
||||
{
|
||||
return this.Insert(index, value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Inserts the string representation of a specified 8-bit unsigned integer into this instance at the specified character position.</summary>
|
||||
/// <returns>A reference to this instance after the insert operation has completed.</returns>
|
||||
/// <param name="index">The position in this instance where insertion begins. </param>
|
||||
/// <param name="value">The value to insert. </param>
|
||||
/// <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.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037F1 RID: 14321 RVA: 0x000BFE74 File Offset: 0x000BE074
|
||||
public StringBuilder Insert(int index, byte value)
|
||||
{
|
||||
return this.Insert(index, value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Inserts the string representation of a specified Unicode character into this instance at the specified character position.</summary>
|
||||
/// <returns>A reference to this instance after the insert operation has completed.</returns>
|
||||
/// <param name="index">The position in this instance where insertion begins. </param>
|
||||
/// <param name="value">The value to insert. </param>
|
||||
/// <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.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037F2 RID: 14322 RVA: 0x000BFE84 File Offset: 0x000BE084
|
||||
public StringBuilder Insert(int index, char value)
|
||||
{
|
||||
if (index > this._length || index < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
}
|
||||
this.InternalEnsureCapacity(this._length + 1);
|
||||
string.CharCopyReverse(this._str, index + 1, this._str, index, this._length - index);
|
||||
this._str.InternalSetChar(index, value);
|
||||
this._length++;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Inserts the string representation of a decimal number into this instance at the specified character position.</summary>
|
||||
/// <returns>A reference to this instance after the insert operation has completed.</returns>
|
||||
/// <param name="index">The position in this instance where insertion begins. </param>
|
||||
/// <param name="value">The value to insert. </param>
|
||||
/// <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.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037F3 RID: 14323 RVA: 0x000BFEF8 File Offset: 0x000BE0F8
|
||||
public StringBuilder Insert(int index, decimal value)
|
||||
{
|
||||
return this.Insert(index, value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Inserts the string representation of a double-precision floating-point number into this instance at the specified character position.</summary>
|
||||
/// <returns>A reference to this instance after the insert operation has completed.</returns>
|
||||
/// <param name="index">The position in this instance where insertion begins. </param>
|
||||
/// <param name="value">The value to insert. </param>
|
||||
/// <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.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037F4 RID: 14324 RVA: 0x000BFF08 File Offset: 0x000BE108
|
||||
public StringBuilder Insert(int index, double value)
|
||||
{
|
||||
return this.Insert(index, value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Inserts the string representation of a specified 16-bit signed integer into this instance at the specified character position.</summary>
|
||||
/// <returns>A reference to this instance after the insert operation has completed.</returns>
|
||||
/// <param name="index">The position in this instance where insertion begins. </param>
|
||||
/// <param name="value">The value to insert. </param>
|
||||
/// <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.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037F5 RID: 14325 RVA: 0x000BFF18 File Offset: 0x000BE118
|
||||
public StringBuilder Insert(int index, short value)
|
||||
{
|
||||
return this.Insert(index, value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Inserts the string representation of a specified 32-bit signed integer into this instance at the specified character position.</summary>
|
||||
/// <returns>A reference to this instance after the insert operation has completed.</returns>
|
||||
/// <param name="index">The position in this instance where insertion begins. </param>
|
||||
/// <param name="value">The value to insert. </param>
|
||||
/// <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.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037F6 RID: 14326 RVA: 0x000BFF28 File Offset: 0x000BE128
|
||||
public StringBuilder Insert(int index, int value)
|
||||
{
|
||||
return this.Insert(index, value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Inserts the string representation of a 64-bit signed integer into this instance at the specified character position.</summary>
|
||||
/// <returns>A reference to this instance after the insert operation has completed.</returns>
|
||||
/// <param name="index">The position in this instance where insertion begins. </param>
|
||||
/// <param name="value">The value to insert. </param>
|
||||
/// <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.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037F7 RID: 14327 RVA: 0x000BFF38 File Offset: 0x000BE138
|
||||
public StringBuilder Insert(int index, long value)
|
||||
{
|
||||
return this.Insert(index, value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Inserts the string representation of an object into this instance at the specified character position.</summary>
|
||||
/// <returns>A reference to this instance after the insert operation has completed.</returns>
|
||||
/// <param name="index">The position in this instance where insertion begins. </param>
|
||||
/// <param name="value">The object to insert or null. </param>
|
||||
/// <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.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037F8 RID: 14328 RVA: 0x000BFF48 File Offset: 0x000BE148
|
||||
public StringBuilder Insert(int index, object value)
|
||||
{
|
||||
return this.Insert(index, value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Inserts the string representation of a specified 8-bit signed integer into this instance at the specified character position.</summary>
|
||||
/// <returns>A reference to this instance after the insert operation has completed.</returns>
|
||||
/// <param name="index">The position in this instance where insertion begins. </param>
|
||||
/// <param name="value">The value to insert. </param>
|
||||
/// <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.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037F9 RID: 14329 RVA: 0x000BFF58 File Offset: 0x000BE158
|
||||
[CLSCompliant(false)]
|
||||
public StringBuilder Insert(int index, sbyte value)
|
||||
{
|
||||
return this.Insert(index, value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Inserts the string representation of a single-precision floating point number into this instance at the specified character position.</summary>
|
||||
/// <returns>A reference to this instance after the insert operation has completed.</returns>
|
||||
/// <param name="index">The position in this instance where insertion begins. </param>
|
||||
/// <param name="value">The value to insert. </param>
|
||||
/// <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.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037FA RID: 14330 RVA: 0x000BFF68 File Offset: 0x000BE168
|
||||
public StringBuilder Insert(int index, float value)
|
||||
{
|
||||
return this.Insert(index, value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Inserts the string representation of a 16-bit unsigned integer into this instance at the specified character position.</summary>
|
||||
/// <returns>A reference to this instance after the insert operation has completed.</returns>
|
||||
/// <param name="index">The position in this instance where insertion begins. </param>
|
||||
/// <param name="value">The value to insert. </param>
|
||||
/// <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.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037FB RID: 14331 RVA: 0x000BFF78 File Offset: 0x000BE178
|
||||
[CLSCompliant(false)]
|
||||
public StringBuilder Insert(int index, ushort value)
|
||||
{
|
||||
return this.Insert(index, value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Inserts the string representation of a 32-bit unsigned integer into this instance at the specified character position.</summary>
|
||||
/// <returns>A reference to this instance after the insert operation has completed.</returns>
|
||||
/// <param name="index">The position in this instance where insertion begins. </param>
|
||||
/// <param name="value">The value to insert. </param>
|
||||
/// <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.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037FC RID: 14332 RVA: 0x000BFF88 File Offset: 0x000BE188
|
||||
[CLSCompliant(false)]
|
||||
public StringBuilder Insert(int index, uint value)
|
||||
{
|
||||
return this.Insert(index, value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Inserts the string representation of a 64-bit unsigned integer into this instance at the specified character position.</summary>
|
||||
/// <returns>A reference to this instance after the insert operation has completed.</returns>
|
||||
/// <param name="index">The position in this instance where insertion begins. </param>
|
||||
/// <param name="value">The value to insert. </param>
|
||||
/// <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.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037FD RID: 14333 RVA: 0x000BFF98 File Offset: 0x000BE198
|
||||
[CLSCompliant(false)]
|
||||
public StringBuilder Insert(int index, ulong value)
|
||||
{
|
||||
return this.Insert(index, value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Inserts one or more copies of a specified string into this instance at the specified character position.</summary>
|
||||
/// <returns>A reference to this instance after insertion has completed.</returns>
|
||||
/// <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>
|
||||
/// <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. -or-The current length of this <see cref="T:System.Text.StringBuilder" /> object plus the length of <paramref name="value" /> times <paramref name="count" /> exceeds <see cref="P:System.Text.StringBuilder.MaxCapacity" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037FE RID: 14334 RVA: 0x000BFFA8 File Offset: 0x000BE1A8
|
||||
public StringBuilder Insert(int index, string value, int count)
|
||||
{
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
if (value != null && value != string.Empty)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
this.Insert(index, value);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Inserts the string representation of a specified subarray of Unicode characters into this instance at the specified character position.</summary>
|
||||
/// <returns>A reference to this instance after the insert operation has completed.</returns>
|
||||
/// <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>
|
||||
/// <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 <paramref name="value" />.-or- Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060037FF RID: 14335 RVA: 0x000BFFF4 File Offset: 0x000BE1F4
|
||||
public StringBuilder Insert(int index, char[] value, int startIndex, int charCount)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
if (startIndex == 0 && charCount == 0)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (charCount < 0 || startIndex < 0 || startIndex > value.Length - charCount)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
return this.Insert(index, new string(value, startIndex, charCount));
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06003800 RID: 14336 RVA: 0x000C0054 File Offset: 0x000BE254
|
||||
private void InternalEnsureCapacity(int size)
|
||||
{
|
||||
if (size > this._str.Length || this._cached_str == this._str)
|
||||
{
|
||||
int num = this._str.Length;
|
||||
if (size > num)
|
||||
{
|
||||
if (this._cached_str == this._str && num < 16)
|
||||
{
|
||||
num = 16;
|
||||
}
|
||||
num <<= 1;
|
||||
if (size > num)
|
||||
{
|
||||
num = size;
|
||||
}
|
||||
if (num >= 2147483647 || num < 0)
|
||||
{
|
||||
num = int.MaxValue;
|
||||
}
|
||||
if (num > this._maxCapacity && size <= this._maxCapacity)
|
||||
{
|
||||
num = this._maxCapacity;
|
||||
}
|
||||
if (num > this._maxCapacity)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("size", "capacity was less than the current size.");
|
||||
}
|
||||
}
|
||||
string text = string.InternalAllocateStr(num);
|
||||
if (this._length > 0)
|
||||
{
|
||||
string.CharCopy(text, 0, this._str, 0, this._length);
|
||||
}
|
||||
this._str = text;
|
||||
}
|
||||
this._cached_str = null;
|
||||
}
|
||||
|
||||
/// <summary>Copies the characters from a specified segment of this instance to a specified segment of a destination <see cref="T:System.Char" /> array.</summary>
|
||||
/// <param name="sourceIndex">The starting position in this instance where characters will be copied from. The index is zero-based.</param>
|
||||
/// <param name="destination">The <see cref="T:System.Char" /> array where characters will be copied to.</param>
|
||||
/// <param name="destinationIndex">The starting position in <paramref name="destination" /> where characters will be copied to. 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 name="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 this instance.-or-<paramref name="destinationIndex" /> + <paramref name="count" /> is greater than the length of <paramref name="destination" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003801 RID: 14337 RVA: 0x000C0148 File Offset: 0x000BE348
|
||||
[ComVisible(false)]
|
||||
public void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count)
|
||||
{
|
||||
if (destination == null)
|
||||
{
|
||||
throw new ArgumentNullException("destination");
|
||||
}
|
||||
if (this.Length - count < sourceIndex || destination.Length - count < destinationIndex || sourceIndex < 0 || destinationIndex < 0 || count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
destination[destinationIndex + i] = this._str[sourceIndex + i];
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040016B4 RID: 5812
|
||||
private const int constDefaultCapacity = 16;
|
||||
|
||||
// Token: 0x040016B5 RID: 5813
|
||||
private int _length;
|
||||
|
||||
// Token: 0x040016B6 RID: 5814
|
||||
private string _str;
|
||||
|
||||
// Token: 0x040016B7 RID: 5815
|
||||
private string _cached_str;
|
||||
|
||||
// Token: 0x040016B8 RID: 5816
|
||||
private int _maxCapacity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
// Token: 0x020005FB RID: 1531
|
||||
[Serializable]
|
||||
internal sealed class SurrogateEncoder : ISerializable, IObjectReference
|
||||
{
|
||||
// Token: 0x06003802 RID: 14338 RVA: 0x000C01C4 File Offset: 0x000BE3C4
|
||||
private SurrogateEncoder(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
if (info == null)
|
||||
{
|
||||
throw new ArgumentNullException("info");
|
||||
}
|
||||
this.encoding = (Encoding)info.GetValue("m_encoding", typeof(Encoding));
|
||||
}
|
||||
|
||||
// Token: 0x06003803 RID: 14339 RVA: 0x000C0200 File Offset: 0x000BE400
|
||||
public void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
throw new ArgumentException("This class cannot be serialized.");
|
||||
}
|
||||
|
||||
// Token: 0x06003804 RID: 14340 RVA: 0x000C020C File Offset: 0x000BE40C
|
||||
public object GetRealObject(StreamingContext context)
|
||||
{
|
||||
if (this.realObject == null)
|
||||
{
|
||||
this.realObject = this.encoding.GetEncoder();
|
||||
}
|
||||
return this.realObject;
|
||||
}
|
||||
|
||||
// Token: 0x040016B9 RID: 5817
|
||||
private Encoding encoding;
|
||||
|
||||
// Token: 0x040016BA RID: 5818
|
||||
private Encoder realObject;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,698 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Represents a UTF-32 encoding of Unicode characters.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x020005FC RID: 1532
|
||||
[Serializable]
|
||||
public sealed class UTF32Encoding : Encoding
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.UTF32Encoding" /> class.</summary>
|
||||
// Token: 0x06003805 RID: 14341 RVA: 0x000C023C File Offset: 0x000BE43C
|
||||
public UTF32Encoding()
|
||||
: this(false, true, false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.UTF32Encoding" /> class. Parameters specify whether to use the big endian byte order and whether to provide a Unicode byte order mark.</summary>
|
||||
/// <param name="bigEndian">true to use the big endian byte order (most significant byte first), or false to use the little endian byte order (least significant byte first). </param>
|
||||
/// <param name="byteOrderMark">true to specify that a Unicode byte order mark is provided; otherwise, false. </param>
|
||||
// Token: 0x06003806 RID: 14342 RVA: 0x000C0248 File Offset: 0x000BE448
|
||||
public UTF32Encoding(bool bigEndian, bool byteOrderMark)
|
||||
: this(bigEndian, byteOrderMark, false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.UTF32Encoding" /> class. Parameters specify whether to use the big endian byte order, whether to provide a Unicode byte order mark, and whether to throw an exception when an invalid encoding is detected.</summary>
|
||||
/// <param name="bigEndian">true to use the big endian byte order (most significant byte first), or false to use the little endian byte order (least significant byte first). </param>
|
||||
/// <param name="byteOrderMark">true to specify that a Unicode byte order mark is provided; otherwise, false. </param>
|
||||
/// <param name="throwOnInvalidCharacters">true to specify that an exception should be thrown when an invalid encoding is detected; otherwise, false. </param>
|
||||
// Token: 0x06003807 RID: 14343 RVA: 0x000C0254 File Offset: 0x000BE454
|
||||
public UTF32Encoding(bool bigEndian, bool byteOrderMark, bool throwOnInvalidCharacters)
|
||||
: base((!bigEndian) ? 12000 : 12001)
|
||||
{
|
||||
this.bigEndian = bigEndian;
|
||||
this.byteOrderMark = byteOrderMark;
|
||||
if (throwOnInvalidCharacters)
|
||||
{
|
||||
base.SetFallbackInternal(EncoderFallback.ExceptionFallback, DecoderFallback.ExceptionFallback);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.SetFallbackInternal(new EncoderReplacementFallback("\ufffd"), new DecoderReplacementFallback("\ufffd"));
|
||||
}
|
||||
if (bigEndian)
|
||||
{
|
||||
this.body_name = "utf-32BE";
|
||||
this.encoding_name = "UTF-32 (Big-Endian)";
|
||||
this.header_name = "utf-32BE";
|
||||
this.web_name = "utf-32BE";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.body_name = "utf-32";
|
||||
this.encoding_name = "UTF-32";
|
||||
this.header_name = "utf-32";
|
||||
this.web_name = "utf-32";
|
||||
}
|
||||
this.windows_code_page = 12000;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of bytes produced by encoding a set of characters from the specified character array.</summary>
|
||||
/// <returns>The number of bytes produced by encoding the specified characters.</returns>
|
||||
/// <param name="chars">The character array containing the set of characters to encode. </param>
|
||||
/// <param name="index">The index of the first character to encode. </param>
|
||||
/// <param name="count">The number of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="chars" />.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="chars" /> contains an invalid sequence of characters. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003808 RID: 14344 RVA: 0x000C0330 File Offset: 0x000BE530
|
||||
[MonoTODO("handle fallback")]
|
||||
public override int GetByteCount(char[] chars, int index, int count)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (index < 0 || index > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (count < 0 || count > chars.Length - index)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
int num = 0;
|
||||
for (int i = index; i < index + count; i++)
|
||||
{
|
||||
if (char.IsSurrogate(chars[i]))
|
||||
{
|
||||
if (i + 1 < chars.Length && char.IsSurrogate(chars[i + 1]))
|
||||
{
|
||||
num += 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
num += 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
num += 4;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>Encodes a set of characters from the specified character array into the specified byte array.</summary>
|
||||
/// <returns>The actual number of bytes written into <paramref name="bytes" />.</returns>
|
||||
/// <param name="chars">The character array containing the set of characters to encode. </param>
|
||||
/// <param name="charIndex">The index of the first character to encode. </param>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <param name="bytes">The byte array to contain the resulting sequence of bytes. </param>
|
||||
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null.-or- <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charIndex" /> or <paramref name="charCount" /> or <paramref name="byteIndex" /> is less than zero.-or- <paramref name="charIndex" /> and <paramref name="charCount" /> do not denote a valid range in <paramref name="chars" />.-or- <paramref name="byteIndex" /> is not a valid index in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="chars" /> contains an invalid sequence of characters.-or- <paramref name="bytes" /> does not have enough capacity from <paramref name="byteIndex" /> to the end of the array to accommodate the resulting bytes. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003809 RID: 14345 RVA: 0x000C03F0 File Offset: 0x000BE5F0
|
||||
[MonoTODO("handle fallback")]
|
||||
public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (charIndex < 0 || charIndex > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charCount < 0 || charCount > chars.Length - charIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (bytes.Length - byteIndex < charCount * 4)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"));
|
||||
}
|
||||
int num = byteIndex;
|
||||
while (charCount-- > 0)
|
||||
{
|
||||
char c = chars[charIndex++];
|
||||
if (char.IsSurrogate(c))
|
||||
{
|
||||
if (charCount-- > 0)
|
||||
{
|
||||
int num2 = (int)('Ѐ' * (c - '\ud800')) + 65536 + (int)chars[charIndex++] - 56320;
|
||||
if (this.bigEndian)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
bytes[num + 3 - i] = (byte)(num2 % 256);
|
||||
num2 >>= 8;
|
||||
}
|
||||
num += 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
bytes[num++] = (byte)(num2 % 256);
|
||||
num2 >>= 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (this.bigEndian)
|
||||
{
|
||||
bytes[num++] = 0;
|
||||
bytes[num++] = 0;
|
||||
bytes[num++] = 0;
|
||||
bytes[num++] = 63;
|
||||
}
|
||||
else
|
||||
{
|
||||
bytes[num++] = 63;
|
||||
bytes[num++] = 0;
|
||||
bytes[num++] = 0;
|
||||
bytes[num++] = 0;
|
||||
}
|
||||
}
|
||||
else if (this.bigEndian)
|
||||
{
|
||||
bytes[num++] = 0;
|
||||
bytes[num++] = 0;
|
||||
bytes[num++] = (byte)(c >> 8);
|
||||
bytes[num++] = (byte)c;
|
||||
}
|
||||
else
|
||||
{
|
||||
bytes[num++] = (byte)c;
|
||||
bytes[num++] = (byte)(c >> 8);
|
||||
bytes[num++] = 0;
|
||||
bytes[num++] = 0;
|
||||
}
|
||||
}
|
||||
return num - byteIndex;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.</summary>
|
||||
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <param name="index">The index of the first byte to decode. </param>
|
||||
/// <param name="count">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="bytes" />.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="bytes" /> contains an invalid sequence of bytes. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600380A RID: 14346 RVA: 0x000C0638 File Offset: 0x000BE838
|
||||
public override int GetCharCount(byte[] bytes, int index, int count)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (index < 0 || index > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (count < 0 || count > bytes.Length - index)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
return count / 4;
|
||||
}
|
||||
|
||||
/// <summary>Decodes a sequence of bytes from the specified byte array into the specified character array.</summary>
|
||||
/// <returns>The actual number of characters written into <paramref name="chars" />.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <param name="byteIndex">The index of the first byte to decode. </param>
|
||||
/// <param name="byteCount">The number of bytes to decode. </param>
|
||||
/// <param name="chars">The character array to contain the resulting set of characters. </param>
|
||||
/// <param name="charIndex">The index at which to start writing the resulting set of characters. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null.-or- <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteIndex" /> or <paramref name="byteCount" /> or <paramref name="charIndex" /> is less than zero.-or- <paramref name="byteindex" /> and <paramref name="byteCount" /> do not denote a valid range in <paramref name="bytes" />.-or- <paramref name="charIndex" /> is not a valid index in <paramref name="chars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="bytes" /> contains an invalid sequence of bytes.-or- <paramref name="chars" /> does not have enough capacity from <paramref name="charIndex" /> to the end of the array to accommodate the resulting characters. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600380B RID: 14347 RVA: 0x000C06A8 File Offset: 0x000BE8A8
|
||||
public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (byteCount < 0 || byteCount > bytes.Length - byteIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charIndex < 0 || charIndex > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (chars.Length - charIndex < byteCount / 4)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"));
|
||||
}
|
||||
int num = charIndex;
|
||||
if (this.bigEndian)
|
||||
{
|
||||
while (byteCount >= 4)
|
||||
{
|
||||
chars[num++] = (char)(((int)bytes[byteIndex] << 24) | ((int)bytes[byteIndex + 1] << 16) | ((int)bytes[byteIndex + 2] << 8) | (int)bytes[byteIndex + 3]);
|
||||
byteIndex += 4;
|
||||
byteCount -= 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (byteCount >= 4)
|
||||
{
|
||||
chars[num++] = (char)((int)bytes[byteIndex] | ((int)bytes[byteIndex + 1] << 8) | ((int)bytes[byteIndex + 2] << 16) | ((int)bytes[byteIndex + 3] << 24));
|
||||
byteIndex += 4;
|
||||
byteCount -= 4;
|
||||
}
|
||||
}
|
||||
return num - charIndex;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the maximum number of bytes produced by encoding the specified number of characters.</summary>
|
||||
/// <returns>The maximum number of bytes produced by encoding the specified number of characters.</returns>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charCount" /> is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600380C RID: 14348 RVA: 0x000C07FC File Offset: 0x000BE9FC
|
||||
public override int GetMaxByteCount(int charCount)
|
||||
{
|
||||
if (charCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount", Encoding._("ArgRange_NonNegative"));
|
||||
}
|
||||
return charCount * 4;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the maximum number of characters produced by decoding the specified number of bytes.</summary>
|
||||
/// <returns>The maximum number of characters produced by decoding the specified number of bytes.</returns>
|
||||
/// <param name="byteCount">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteCount" /> is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600380D RID: 14349 RVA: 0x000C0820 File Offset: 0x000BEA20
|
||||
public override int GetMaxCharCount(int byteCount)
|
||||
{
|
||||
if (byteCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount", Encoding._("ArgRange_NonNegative"));
|
||||
}
|
||||
return byteCount / 4;
|
||||
}
|
||||
|
||||
/// <summary>Obtains a decoder that converts a UTF-32 encoded sequence of bytes into a sequence of Unicode characters.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.Decoder" /> that converts a UTF-32 encoded sequence of bytes into a sequence of Unicode characters.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600380E RID: 14350 RVA: 0x000C0844 File Offset: 0x000BEA44
|
||||
public override Decoder GetDecoder()
|
||||
{
|
||||
return new UTF32Encoding.UTF32Decoder(this.bigEndian);
|
||||
}
|
||||
|
||||
/// <summary>Returns a Unicode byte order mark encoded in UTF-32 format, if the constructor for this instance requests a byte order mark.</summary>
|
||||
/// <returns>A byte array containing the Unicode byte order mark, if the constructor for this instance requests a byte order mark. Otherwise, this method returns a byte array of length zero.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600380F RID: 14351 RVA: 0x000C0854 File Offset: 0x000BEA54
|
||||
public override byte[] GetPreamble()
|
||||
{
|
||||
if (this.byteOrderMark)
|
||||
{
|
||||
byte[] array = new byte[4];
|
||||
if (this.bigEndian)
|
||||
{
|
||||
array[2] = 254;
|
||||
array[3] = byte.MaxValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
array[0] = byte.MaxValue;
|
||||
array[1] = 254;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
/// <summary>Determines whether the specified <see cref="T:System.Object" /> is equal to the current <see cref="T:System.Text.UTF32Encoding" /> object.</summary>
|
||||
/// <returns>true if <paramref name="value" /> is an instance of <see cref="T:System.Text.UTF32Encoding" /> and is equal to the current object; otherwise, false.</returns>
|
||||
/// <param name="value">The <see cref="T:System.Object" /> to compare with the current object. </param>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003810 RID: 14352 RVA: 0x000C08AC File Offset: 0x000BEAAC
|
||||
public override bool Equals(object value)
|
||||
{
|
||||
UTF32Encoding utf32Encoding = value as UTF32Encoding;
|
||||
return utf32Encoding != null && (this.codePage == utf32Encoding.codePage && this.bigEndian == utf32Encoding.bigEndian && this.byteOrderMark == utf32Encoding.byteOrderMark) && base.Equals(value);
|
||||
}
|
||||
|
||||
/// <summary>Returns the hash code for the current instance.</summary>
|
||||
/// <returns>The hash code for the current <see cref="T:System.Text.UTF32Encoding" /> object.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003811 RID: 14353 RVA: 0x000C0908 File Offset: 0x000BEB08
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int num = base.GetHashCode();
|
||||
if (this.bigEndian)
|
||||
{
|
||||
num ^= 31;
|
||||
}
|
||||
if (this.byteOrderMark)
|
||||
{
|
||||
num ^= 63;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of bytes produced by encoding a set of characters starting at the specified character pointer.</summary>
|
||||
/// <returns>The number of bytes produced by encoding the specified characters.</returns>
|
||||
/// <param name="chars">A pointer to the first character to encode. </param>
|
||||
/// <param name="count">The number of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="count" /> is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="chars" /> contains an invalid sequence of characters. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003812 RID: 14354 RVA: 0x000C0940 File Offset: 0x000BEB40
|
||||
[CLSCompliant(false)]
|
||||
public unsafe override int GetByteCount(char* chars, int count)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
return count * 4;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of bytes produced by encoding the characters in the specified <see cref="T:System.String" />.</summary>
|
||||
/// <returns>The number of bytes produced by encoding the specified characters.</returns>
|
||||
/// <param name="s">The <see cref="T:System.String" /> containing the set of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="s" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="s" /> contains an invalid sequence of characters. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003813 RID: 14355 RVA: 0x000C0958 File Offset: 0x000BEB58
|
||||
public override int GetByteCount(string s)
|
||||
{
|
||||
return base.GetByteCount(s);
|
||||
}
|
||||
|
||||
/// <summary>Encodes a set of characters starting at the specified character pointer into a sequence of bytes that are stored starting at the specified byte pointer.</summary>
|
||||
/// <returns>The actual number of bytes written at the location indicated by the <paramref name="bytes" /> parameter.</returns>
|
||||
/// <param name="chars">A pointer to the first character to encode. </param>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <param name="bytes">A pointer to the location at which to start writing the resulting sequence of bytes. </param>
|
||||
/// <param name="byteCount">The maximum number of bytes to write. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null.-or- <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charCount" /> or <paramref name="byteCount" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="chars" /> contains an invalid sequence of characters.-or- <paramref name="byteCount" /> is less than the resulting number of bytes. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003814 RID: 14356 RVA: 0x000C0964 File Offset: 0x000BEB64
|
||||
[CLSCompliant(false)]
|
||||
public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount)
|
||||
{
|
||||
return base.GetBytes(chars, charCount, bytes, byteCount);
|
||||
}
|
||||
|
||||
/// <summary>Encodes a set of characters from the specified <see cref="T:System.String" /> into the specified byte array.</summary>
|
||||
/// <returns>The actual number of bytes written into <paramref name="bytes" />.</returns>
|
||||
/// <param name="s">The <see cref="T:System.String" /> containing the set of characters to encode. </param>
|
||||
/// <param name="charIndex">The index of the first character to encode. </param>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <param name="bytes">The byte array to contain the resulting sequence of bytes. </param>
|
||||
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="s" /> is null.-or- <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charIndex" /> or <paramref name="charCount" /> or <paramref name="byteIndex" /> is less than zero.-or- <paramref name="charIndex" /> and <paramref name="charCount" /> do not denote a valid range in <paramref name="chars" />.-or- <paramref name="byteIndex" /> is not a valid index in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="s" /> contains an invalid sequence of characters.-or- <paramref name="bytes" /> does not have enough capacity from <paramref name="byteIndex" /> to the end of the array to accommodate the resulting bytes. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003815 RID: 14357 RVA: 0x000C0974 File Offset: 0x000BEB74
|
||||
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex)
|
||||
{
|
||||
return base.GetBytes(s, charIndex, charCount, bytes, byteIndex);
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of characters produced by decoding a sequence of bytes starting at the specified byte pointer.</summary>
|
||||
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">A pointer to the first byte to decode. </param>
|
||||
/// <param name="count">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="count" /> is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="bytes" /> contains an invalid sequence of bytes. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003816 RID: 14358 RVA: 0x000C0984 File Offset: 0x000BEB84
|
||||
[CLSCompliant(false)]
|
||||
public unsafe override int GetCharCount(byte* bytes, int count)
|
||||
{
|
||||
return base.GetCharCount(bytes, count);
|
||||
}
|
||||
|
||||
/// <summary>Decodes a sequence of bytes starting at the specified byte pointer into a set of characters that are stored starting at the specified character pointer.</summary>
|
||||
/// <returns>The actual number of characters written at the location indicated by <paramref name="chars" />.</returns>
|
||||
/// <param name="bytes">A pointer to the first byte to decode. </param>
|
||||
/// <param name="byteCount">The number of bytes to decode. </param>
|
||||
/// <param name="chars">A pointer to the location at which to start writing the resulting set of characters. </param>
|
||||
/// <param name="charCount">The maximum number of characters to write. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null.-or- <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteCount" /> or <paramref name="charCount" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="bytes" /> contains an invalid sequence of bytes.-or- <paramref name="charCount" /> is less than the resulting number of characters. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003817 RID: 14359 RVA: 0x000C0990 File Offset: 0x000BEB90
|
||||
[CLSCompliant(false)]
|
||||
public unsafe override int GetChars(byte* bytes, int byteCount, char* chars, int charCount)
|
||||
{
|
||||
return base.GetChars(bytes, byteCount, chars, charCount);
|
||||
}
|
||||
|
||||
/// <summary>Decodes a range of bytes from a byte array into a string.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> containing the results of decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <param name="index">The index of the first byte to decode. </param>
|
||||
/// <param name="count">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="bytes" /> contains an invalid sequence of bytes. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003818 RID: 14360 RVA: 0x000C09A0 File Offset: 0x000BEBA0
|
||||
public override string GetString(byte[] bytes, int index, int count)
|
||||
{
|
||||
return base.GetString(bytes, index, count);
|
||||
}
|
||||
|
||||
/// <summary>Obtains an encoder that converts a sequence of Unicode characters into a UTF-32 encoded sequence of bytes.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.Encoder" /> that converts a sequence of Unicode characters into a UTF-32 encoded sequence of bytes.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003819 RID: 14361 RVA: 0x000C09AC File Offset: 0x000BEBAC
|
||||
public override Encoder GetEncoder()
|
||||
{
|
||||
return base.GetEncoder();
|
||||
}
|
||||
|
||||
// Token: 0x040016BB RID: 5819
|
||||
internal const int UTF32_CODE_PAGE = 12000;
|
||||
|
||||
// Token: 0x040016BC RID: 5820
|
||||
internal const int BIG_UTF32_CODE_PAGE = 12001;
|
||||
|
||||
// Token: 0x040016BD RID: 5821
|
||||
private bool bigEndian;
|
||||
|
||||
// Token: 0x040016BE RID: 5822
|
||||
private bool byteOrderMark;
|
||||
|
||||
// Token: 0x020005FD RID: 1533
|
||||
private sealed class UTF32Decoder : Decoder
|
||||
{
|
||||
// Token: 0x0600381A RID: 14362 RVA: 0x000C09B4 File Offset: 0x000BEBB4
|
||||
public UTF32Decoder(bool bigEndian)
|
||||
{
|
||||
this.bigEndian = bigEndian;
|
||||
this.leftOverByte = -1;
|
||||
}
|
||||
|
||||
// Token: 0x0600381B RID: 14363 RVA: 0x000C09CC File Offset: 0x000BEBCC
|
||||
public override int GetCharCount(byte[] bytes, int index, int count)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (index < 0 || index > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (count < 0 || count > bytes.Length - index)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (this.leftOverByte != -1)
|
||||
{
|
||||
return (count + 1) / 4;
|
||||
}
|
||||
return count / 4;
|
||||
}
|
||||
|
||||
// Token: 0x0600381C RID: 14364 RVA: 0x000C0A4C File Offset: 0x000BEC4C
|
||||
public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (byteCount < 0 || byteCount > bytes.Length - byteIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charIndex < 0 || charIndex > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
int num = charIndex;
|
||||
int num2 = this.leftOverByte;
|
||||
int num3 = chars.Length;
|
||||
int num4 = 4 - this.leftOverLength;
|
||||
if (this.leftOverLength > 0 && byteCount > num4)
|
||||
{
|
||||
if (this.bigEndian)
|
||||
{
|
||||
for (int i = 0; i < num4; i++)
|
||||
{
|
||||
num2 += (int)bytes[byteIndex++] << 4 - byteCount--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < num4; j++)
|
||||
{
|
||||
num2 += (int)bytes[byteIndex++] << byteCount--;
|
||||
}
|
||||
}
|
||||
if ((num2 > 65535 && num + 1 < num3) || num < num3)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"));
|
||||
}
|
||||
if (num2 > 65535)
|
||||
{
|
||||
chars[num++] = (char)((num2 - 10000) / 1024 + 55296);
|
||||
chars[num++] = (char)((num2 - 10000) % 1024 + 56320);
|
||||
}
|
||||
else
|
||||
{
|
||||
chars[num++] = (char)num2;
|
||||
}
|
||||
this.leftOverLength = 0;
|
||||
}
|
||||
while (byteCount > 3)
|
||||
{
|
||||
char c;
|
||||
if (this.bigEndian)
|
||||
{
|
||||
c = (char)(((int)bytes[byteIndex++] << 24) | ((int)bytes[byteIndex++] << 16) | ((int)bytes[byteIndex++] << 8) | (int)bytes[byteIndex++]);
|
||||
}
|
||||
else
|
||||
{
|
||||
c = (char)((int)bytes[byteIndex++] | ((int)bytes[byteIndex++] << 8) | ((int)bytes[byteIndex++] << 16) | ((int)bytes[byteIndex++] << 24));
|
||||
}
|
||||
byteCount -= 4;
|
||||
if (num >= num3)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"));
|
||||
}
|
||||
chars[num++] = c;
|
||||
}
|
||||
if (byteCount > 0)
|
||||
{
|
||||
this.leftOverLength = byteCount;
|
||||
num2 = 0;
|
||||
if (this.bigEndian)
|
||||
{
|
||||
for (int k = 0; k < byteCount; k++)
|
||||
{
|
||||
num2 += (int)bytes[byteIndex++] << 4 - byteCount--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int l = 0; l < byteCount; l++)
|
||||
{
|
||||
num2 += (int)bytes[byteIndex++] << byteCount--;
|
||||
}
|
||||
}
|
||||
this.leftOverByte = num2;
|
||||
}
|
||||
return num - charIndex;
|
||||
}
|
||||
|
||||
// Token: 0x040016BF RID: 5823
|
||||
private bool bigEndian;
|
||||
|
||||
// Token: 0x040016C0 RID: 5824
|
||||
private int leftOverByte;
|
||||
|
||||
// Token: 0x040016C1 RID: 5825
|
||||
private int leftOverLength;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,889 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Represents a UTF-7 encoding of Unicode characters.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x020005FE RID: 1534
|
||||
[MonoTODO("Serialization format not compatible with .NET")]
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public class UTF7Encoding : Encoding
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.UTF7Encoding" /> class.</summary>
|
||||
// Token: 0x0600381D RID: 14365 RVA: 0x000C0D3C File Offset: 0x000BEF3C
|
||||
public UTF7Encoding()
|
||||
: this(false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.UTF7Encoding" /> class. A parameter specifies whether to allow optional characters.</summary>
|
||||
/// <param name="allowOptionals">true to specify that optional characters are allowed; otherwise, false. </param>
|
||||
// Token: 0x0600381E RID: 14366 RVA: 0x000C0D48 File Offset: 0x000BEF48
|
||||
public UTF7Encoding(bool allowOptionals)
|
||||
: base(65000)
|
||||
{
|
||||
this.allowOptionals = allowOptionals;
|
||||
this.body_name = "utf-7";
|
||||
this.encoding_name = "Unicode (UTF-7)";
|
||||
this.header_name = "utf-7";
|
||||
this.is_mail_news_display = true;
|
||||
this.is_mail_news_save = true;
|
||||
this.web_name = "utf-7";
|
||||
this.windows_code_page = 1200;
|
||||
}
|
||||
|
||||
/// <summary>Returns the hash code for the current <see cref="T:System.Text.UTF7Encoding" /> object.</summary>
|
||||
/// <returns>A 32-bit signed integer hash code.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003820 RID: 14368 RVA: 0x000C0DF0 File Offset: 0x000BEFF0
|
||||
[ComVisible(false)]
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int hashCode = base.GetHashCode();
|
||||
return (!this.allowOptionals) ? hashCode : (-hashCode);
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the specified object is equal to the current <see cref="T:System.Text.UTF7Encoding" /> object.</summary>
|
||||
/// <returns>true if <paramref name="value" /> is a <see cref="T:System.Text.UTF7Encoding" /> object and is equal to the current <see cref="T:System.Text.UTF7Encoding" /> object; otherwise, false.</returns>
|
||||
/// <param name="value">An object to compare to the current <see cref="T:System.Text.UTF7Encoding" /> object.</param>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003821 RID: 14369 RVA: 0x000C0E18 File Offset: 0x000BF018
|
||||
[ComVisible(false)]
|
||||
public override bool Equals(object value)
|
||||
{
|
||||
UTF7Encoding utf7Encoding = value as UTF7Encoding;
|
||||
return utf7Encoding != null && (this.allowOptionals == utf7Encoding.allowOptionals && base.EncoderFallback.Equals(utf7Encoding.EncoderFallback)) && base.DecoderFallback.Equals(utf7Encoding.DecoderFallback);
|
||||
}
|
||||
|
||||
// Token: 0x06003822 RID: 14370 RVA: 0x000C0E70 File Offset: 0x000BF070
|
||||
private static int InternalGetByteCount(char[] chars, int index, int count, bool flush, int leftOver, bool isInShifted, bool allowOptionals)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (index < 0 || index > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (count < 0 || count > chars.Length - index)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
int num = 0;
|
||||
int i = leftOver >> 8;
|
||||
byte[] array = UTF7Encoding.encodingRules;
|
||||
while (count > 0)
|
||||
{
|
||||
int num2 = (int)chars[index++];
|
||||
count--;
|
||||
int num3;
|
||||
if (num2 < 128)
|
||||
{
|
||||
num3 = (int)array[num2];
|
||||
}
|
||||
else
|
||||
{
|
||||
num3 = 0;
|
||||
}
|
||||
switch (num3)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
goto IL_E3;
|
||||
case 2:
|
||||
if (allowOptionals)
|
||||
{
|
||||
goto IL_E3;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (isInShifted)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
num++;
|
||||
i = 0;
|
||||
}
|
||||
num++;
|
||||
isInShifted = false;
|
||||
}
|
||||
num += 2;
|
||||
continue;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
if (!isInShifted)
|
||||
{
|
||||
num++;
|
||||
i = 0;
|
||||
isInShifted = true;
|
||||
}
|
||||
for (i += 16; i >= 6; i -= 6)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
continue;
|
||||
IL_E3:
|
||||
if (isInShifted)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
num++;
|
||||
i = 0;
|
||||
}
|
||||
num++;
|
||||
isInShifted = false;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
if (isInShifted && flush)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of bytes produced by encoding a set of characters from the specified character array.</summary>
|
||||
/// <returns>The number of bytes produced by encoding the specified characters.</returns>
|
||||
/// <param name="chars">The character array containing the set of characters to encode. </param>
|
||||
/// <param name="index">The index of the first character to encode. </param>
|
||||
/// <param name="count">The number of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="chars" />.-or- The resulting number of bytes is greater than the maximum number that can be returned as an int. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003823 RID: 14371 RVA: 0x000C0FDC File Offset: 0x000BF1DC
|
||||
public override int GetByteCount(char[] chars, int index, int count)
|
||||
{
|
||||
return UTF7Encoding.InternalGetByteCount(chars, index, count, true, 0, false, this.allowOptionals);
|
||||
}
|
||||
|
||||
// Token: 0x06003824 RID: 14372 RVA: 0x000C0FF0 File Offset: 0x000BF1F0
|
||||
private static int InternalGetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, bool flush, ref int leftOver, ref bool isInShifted, bool allowOptionals)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (charIndex < 0 || charIndex > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charCount < 0 || charCount > chars.Length - charIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
int num = byteIndex;
|
||||
int num2 = bytes.Length;
|
||||
int i = leftOver >> 8;
|
||||
int num3 = leftOver & 255;
|
||||
byte[] array = UTF7Encoding.encodingRules;
|
||||
string text = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
while (charCount > 0)
|
||||
{
|
||||
int num4 = (int)chars[charIndex++];
|
||||
charCount--;
|
||||
int num5;
|
||||
if (num4 < 128)
|
||||
{
|
||||
num5 = (int)array[num4];
|
||||
}
|
||||
else
|
||||
{
|
||||
num5 = 0;
|
||||
}
|
||||
switch (num5)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
goto IL_19D;
|
||||
case 2:
|
||||
if (allowOptionals)
|
||||
{
|
||||
goto IL_19D;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (isInShifted)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
if (num + 1 > num2)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"), "bytes");
|
||||
}
|
||||
bytes[num++] = (byte)text[num3 << 6 - i];
|
||||
}
|
||||
if (num + 1 > num2)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"), "bytes");
|
||||
}
|
||||
bytes[num++] = 45;
|
||||
isInShifted = false;
|
||||
i = 0;
|
||||
num3 = 0;
|
||||
}
|
||||
if (num + 2 > num2)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"), "bytes");
|
||||
}
|
||||
bytes[num++] = 43;
|
||||
bytes[num++] = 45;
|
||||
continue;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
if (!isInShifted)
|
||||
{
|
||||
if (num >= num2)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"), "bytes");
|
||||
}
|
||||
bytes[num++] = 43;
|
||||
isInShifted = true;
|
||||
i = 0;
|
||||
}
|
||||
num3 = (num3 << 16) | num4;
|
||||
i += 16;
|
||||
while (i >= 6)
|
||||
{
|
||||
if (num >= num2)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"), "bytes");
|
||||
}
|
||||
i -= 6;
|
||||
bytes[num++] = (byte)text[num3 >> i];
|
||||
num3 &= (1 << i) - 1;
|
||||
}
|
||||
continue;
|
||||
IL_19D:
|
||||
if (isInShifted)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
if (num + 1 > num2)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"), "bytes");
|
||||
}
|
||||
bytes[num++] = (byte)text[num3 << 6 - i];
|
||||
}
|
||||
if (num + 1 > num2)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"), "bytes");
|
||||
}
|
||||
bytes[num++] = 45;
|
||||
isInShifted = false;
|
||||
i = 0;
|
||||
num3 = 0;
|
||||
}
|
||||
if (num >= num2)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"), "bytes");
|
||||
}
|
||||
bytes[num++] = (byte)num4;
|
||||
}
|
||||
if (isInShifted && flush)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
if (num + 1 > num2)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"), "bytes");
|
||||
}
|
||||
bytes[num++] = (byte)text[num3 << 6 - i];
|
||||
}
|
||||
bytes[num++] = 45;
|
||||
i = 0;
|
||||
num3 = 0;
|
||||
isInShifted = false;
|
||||
}
|
||||
leftOver = (i << 8) | num3;
|
||||
return num - byteIndex;
|
||||
}
|
||||
|
||||
/// <summary>Encodes a set of characters from the specified character array into the specified byte array.</summary>
|
||||
/// <returns>The actual number of bytes written into <paramref name="bytes" />.</returns>
|
||||
/// <param name="chars">The character array containing the set of characters to encode. </param>
|
||||
/// <param name="charIndex">The index of the first character to encode. </param>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <param name="bytes">The byte array to contain the resulting sequence of bytes. </param>
|
||||
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null (Nothing).-or- <paramref name="bytes" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charIndex" /> or <paramref name="charCount" /> or <paramref name="byteIndex" /> is less than zero.-or- <paramref name="charIndex" /> and <paramref name="charCount" /> do not denote a valid range in <paramref name="chars" />.-or- <paramref name="byteIndex" /> is not a valid index in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="bytes" /> does not have enough capacity from <paramref name="byteIndex" /> to the end of the array to accommodate the resulting bytes. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003825 RID: 14373 RVA: 0x000C1360 File Offset: 0x000BF560
|
||||
public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex)
|
||||
{
|
||||
int num = 0;
|
||||
bool flag = false;
|
||||
return UTF7Encoding.InternalGetBytes(chars, charIndex, charCount, bytes, byteIndex, true, ref num, ref flag, this.allowOptionals);
|
||||
}
|
||||
|
||||
// Token: 0x06003826 RID: 14374 RVA: 0x000C1388 File Offset: 0x000BF588
|
||||
private static int InternalGetCharCount(byte[] bytes, int index, int count, int leftOver)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (index < 0 || index > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (count < 0 || count > bytes.Length - index)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
int num = 0;
|
||||
bool flag = (leftOver & 16777216) == 0;
|
||||
bool flag2 = (leftOver & 33554432) != 0;
|
||||
int num2 = (leftOver >> 16) & 255;
|
||||
sbyte[] array = UTF7Encoding.base64Values;
|
||||
while (count > 0)
|
||||
{
|
||||
int num3 = (int)bytes[index++];
|
||||
count--;
|
||||
if (flag)
|
||||
{
|
||||
if (num3 != 43)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = false;
|
||||
flag2 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num3 == 45)
|
||||
{
|
||||
if (flag2)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
num2 = 0;
|
||||
flag = true;
|
||||
}
|
||||
else if ((int)array[num3] != -1)
|
||||
{
|
||||
num2 += 6;
|
||||
if (num2 >= 16)
|
||||
{
|
||||
num++;
|
||||
num2 -= 16;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
num++;
|
||||
flag = true;
|
||||
num2 = 0;
|
||||
}
|
||||
flag2 = false;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.</summary>
|
||||
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <param name="index">The index of the first byte to decode. </param>
|
||||
/// <param name="count">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="bytes" />.-or- The resulting number of characters is greater than the maximum number that can be returned as an int. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003827 RID: 14375 RVA: 0x000C14AC File Offset: 0x000BF6AC
|
||||
public override int GetCharCount(byte[] bytes, int index, int count)
|
||||
{
|
||||
return UTF7Encoding.InternalGetCharCount(bytes, index, count, 0);
|
||||
}
|
||||
|
||||
// Token: 0x06003828 RID: 14376 RVA: 0x000C14B8 File Offset: 0x000BF6B8
|
||||
private static int InternalGetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, ref int leftOver)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (byteCount < 0 || byteCount > bytes.Length - byteIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charIndex < 0 || charIndex > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
int num = charIndex;
|
||||
int num2 = chars.Length;
|
||||
bool flag = (leftOver & 16777216) == 0;
|
||||
bool flag2 = (leftOver & 33554432) != 0;
|
||||
bool flag3 = (leftOver & 67108864) != 0;
|
||||
int num3 = (leftOver >> 16) & 255;
|
||||
int num4 = leftOver & 65535;
|
||||
sbyte[] array = UTF7Encoding.base64Values;
|
||||
while (byteCount > 0)
|
||||
{
|
||||
int num5 = (int)bytes[byteIndex++];
|
||||
byteCount--;
|
||||
if (flag)
|
||||
{
|
||||
if (num5 != 43)
|
||||
{
|
||||
if (num >= num2)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"), "chars");
|
||||
}
|
||||
if (flag3)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InvalidUTF7"), "chars");
|
||||
}
|
||||
chars[num++] = (char)num5;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = false;
|
||||
flag2 = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int num6;
|
||||
if (num5 == 45)
|
||||
{
|
||||
if (flag2)
|
||||
{
|
||||
if (num >= num2)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"), "chars");
|
||||
}
|
||||
if (flag3)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InvalidUTF7"), "chars");
|
||||
}
|
||||
chars[num++] = '+';
|
||||
}
|
||||
flag = true;
|
||||
num3 = 0;
|
||||
num4 = 0;
|
||||
}
|
||||
else if ((num6 = (int)array[num5]) != -1)
|
||||
{
|
||||
num4 = (num4 << 6) | num6;
|
||||
num3 += 6;
|
||||
if (num3 >= 16)
|
||||
{
|
||||
if (num >= num2)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"), "chars");
|
||||
}
|
||||
num3 -= 16;
|
||||
char c = (char)(num4 >> num3);
|
||||
if ((c & 'ﰀ') == '\ud800')
|
||||
{
|
||||
flag3 = true;
|
||||
}
|
||||
else if ((c & 'ﰀ') == '\udc00')
|
||||
{
|
||||
if (!flag3)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InvalidUTF7"), "chars");
|
||||
}
|
||||
flag3 = false;
|
||||
}
|
||||
chars[num++] = c;
|
||||
num4 &= (1 << num3) - 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num >= num2)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"), "chars");
|
||||
}
|
||||
if (flag3)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InvalidUTF7"), "chars");
|
||||
}
|
||||
chars[num++] = (char)num5;
|
||||
flag = true;
|
||||
num3 = 0;
|
||||
num4 = 0;
|
||||
}
|
||||
flag2 = false;
|
||||
}
|
||||
}
|
||||
leftOver = num4 | (num3 << 16) | ((!flag) ? 16777216 : 0) | ((!flag2) ? 0 : 33554432) | ((!flag3) ? 0 : 67108864);
|
||||
return num - charIndex;
|
||||
}
|
||||
|
||||
/// <summary>Decodes a sequence of bytes from the specified byte array into the specified character array.</summary>
|
||||
/// <returns>The actual number of characters written into <paramref name="chars" />.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <param name="byteIndex">The index of the first byte to decode. </param>
|
||||
/// <param name="byteCount">The number of bytes to decode. </param>
|
||||
/// <param name="chars">The character array to contain the resulting set of characters. </param>
|
||||
/// <param name="charIndex">The index at which to start writing the resulting set of characters. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null (Nothing).-or- <paramref name="chars" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteIndex" /> or <paramref name="byteCount" /> or <paramref name="charIndex" /> is less than zero.-or- <paramref name="byteindex" /> and <paramref name="byteCount" /> do not denote a valid range in <paramref name="bytes" />.-or- <paramref name="charIndex" /> is not a valid index in <paramref name="chars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="chars" /> does not have enough capacity from <paramref name="charIndex" /> to the end of the array to accommodate the resulting characters. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003829 RID: 14377 RVA: 0x000C17DC File Offset: 0x000BF9DC
|
||||
public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
|
||||
{
|
||||
int num = 0;
|
||||
int num2 = UTF7Encoding.InternalGetChars(bytes, byteIndex, byteCount, chars, charIndex, ref num);
|
||||
if ((num & 67108864) != 0)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InvalidUTF7"), "chars");
|
||||
}
|
||||
return num2;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the maximum number of bytes produced by encoding the specified number of characters.</summary>
|
||||
/// <returns>The maximum number of bytes produced by encoding the specified number of characters.</returns>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charCount" /> is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an int. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600382A RID: 14378 RVA: 0x000C181C File Offset: 0x000BFA1C
|
||||
public override int GetMaxByteCount(int charCount)
|
||||
{
|
||||
if (charCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount", Encoding._("ArgRange_NonNegative"));
|
||||
}
|
||||
if (charCount == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 8 * (charCount / 3) + charCount % 3 * 3 + 2;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the maximum number of characters produced by decoding the specified number of bytes.</summary>
|
||||
/// <returns>The maximum number of characters produced by decoding the specified number of bytes.</returns>
|
||||
/// <param name="byteCount">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteCount" /> is less than zero.-or- The resulting number of characters is greater than the maximum number that can be returned as an int. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600382B RID: 14379 RVA: 0x000C1850 File Offset: 0x000BFA50
|
||||
public override int GetMaxCharCount(int byteCount)
|
||||
{
|
||||
if (byteCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount", Encoding._("ArgRange_NonNegative"));
|
||||
}
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
/// <summary>Obtains a decoder that converts a UTF-7 encoded sequence of bytes into a sequence of Unicode characters.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.Decoder" /> that converts a UTF-7 encoded sequence of bytes into a sequence of Unicode characters.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600382C RID: 14380 RVA: 0x000C1870 File Offset: 0x000BFA70
|
||||
public override Decoder GetDecoder()
|
||||
{
|
||||
return new UTF7Encoding.UTF7Decoder();
|
||||
}
|
||||
|
||||
/// <summary>Obtains an encoder that converts a sequence of Unicode characters into a UTF-7 encoded sequence of bytes.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.Encoder" /> that converts a sequence of Unicode characters into a UTF-7 encoded sequence of bytes.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600382D RID: 14381 RVA: 0x000C1878 File Offset: 0x000BFA78
|
||||
public override Encoder GetEncoder()
|
||||
{
|
||||
return new UTF7Encoding.UTF7Encoder(this.allowOptionals);
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of bytes produced by encoding a set of characters starting at the specified character pointer.</summary>
|
||||
/// <returns>The number of bytes produced by encoding the specified characters.</returns>
|
||||
/// <param name="chars">A pointer to the first character to encode. </param>
|
||||
/// <param name="count">The number of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null (Nothing in Visual Basic .NET). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="count" /> is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an int. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600382E RID: 14382 RVA: 0x000C1888 File Offset: 0x000BFA88
|
||||
[CLSCompliant(false)]
|
||||
[ComVisible(false)]
|
||||
public unsafe override int GetByteCount(char* chars, int count)
|
||||
{
|
||||
return base.GetByteCount(chars, count);
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of bytes produced by encoding the characters in the specified <see cref="T:System.String" /> object.</summary>
|
||||
/// <returns>The number of bytes produced by encoding the specified characters.</returns>
|
||||
/// <param name="s">The <see cref="T:System.String" /> object containing the set of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="s" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The resulting number of bytes is greater than the maximum number that can be returned as an int. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600382F RID: 14383 RVA: 0x000C1894 File Offset: 0x000BFA94
|
||||
[ComVisible(false)]
|
||||
public override int GetByteCount(string s)
|
||||
{
|
||||
return base.GetByteCount(s);
|
||||
}
|
||||
|
||||
/// <summary>Encodes a set of characters starting at the specified character pointer into a sequence of bytes that are stored starting at the specified byte pointer.</summary>
|
||||
/// <returns>The actual number of bytes written at the location indicated by <paramref name="bytes" />.</returns>
|
||||
/// <param name="chars">A pointer to the first character to encode. </param>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <param name="bytes">A pointer to the location at which to start writing the resulting sequence of bytes. </param>
|
||||
/// <param name="byteCount">The maximum number of bytes to write. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null (Nothing).-or- <paramref name="bytes" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charCount" /> or <paramref name="byteCount" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="byteCount" /> is less than the resulting number of bytes. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003830 RID: 14384 RVA: 0x000C18A0 File Offset: 0x000BFAA0
|
||||
[ComVisible(false)]
|
||||
[CLSCompliant(false)]
|
||||
public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount)
|
||||
{
|
||||
return base.GetBytes(chars, charCount, bytes, byteCount);
|
||||
}
|
||||
|
||||
/// <summary>Encodes a set of characters from the specified <see cref="T:System.String" /> into the specified byte array.</summary>
|
||||
/// <returns>The actual number of bytes written into <paramref name="bytes" />.</returns>
|
||||
/// <param name="s">The <see cref="T:System.String" /> containing the set of characters to encode. </param>
|
||||
/// <param name="charIndex">The index of the first character to encode. </param>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <param name="bytes">The byte array to contain the resulting sequence of bytes. </param>
|
||||
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="s" /> is null (Nothing).-or- <paramref name="bytes" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charIndex" /> or <paramref name="charCount" /> or <paramref name="byteIndex" /> is less than zero.-or- <paramref name="charIndex" /> and <paramref name="charCount" /> do not denote a valid range in <paramref name="chars" />.-or- <paramref name="byteIndex" /> is not a valid index in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="bytes" /> does not have enough capacity from <paramref name="byteIndex" /> to the end of the array to accommodate the resulting bytes. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003831 RID: 14385 RVA: 0x000C18B0 File Offset: 0x000BFAB0
|
||||
[ComVisible(false)]
|
||||
public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex)
|
||||
{
|
||||
return base.GetBytes(s, charIndex, charCount, bytes, byteIndex);
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of characters produced by decoding a sequence of bytes starting at the specified byte pointer.</summary>
|
||||
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">A pointer to the first byte to decode. </param>
|
||||
/// <param name="count">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="count" /> is less than zero.-or- The resulting number of characters is greater than the maximum number that can be returned as an int. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003832 RID: 14386 RVA: 0x000C18C0 File Offset: 0x000BFAC0
|
||||
[CLSCompliant(false)]
|
||||
[ComVisible(false)]
|
||||
public unsafe override int GetCharCount(byte* bytes, int count)
|
||||
{
|
||||
return base.GetCharCount(bytes, count);
|
||||
}
|
||||
|
||||
/// <summary>Decodes a sequence of bytes starting at the specified byte pointer into a set of characters that are stored starting at the specified character pointer.</summary>
|
||||
/// <returns>The actual number of characters written at the location indicated by <paramref name="chars" />.</returns>
|
||||
/// <param name="bytes">A pointer to the first byte to decode. </param>
|
||||
/// <param name="byteCount">The number of bytes to decode. </param>
|
||||
/// <param name="chars">A pointer to the location at which to start writing the resulting set of characters. </param>
|
||||
/// <param name="charCount">The maximum number of characters to write. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null (Nothing).-or- <paramref name="chars" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteCount" /> or <paramref name="charCount" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="charCount" /> is less than the resulting number of characters. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003833 RID: 14387 RVA: 0x000C18CC File Offset: 0x000BFACC
|
||||
[CLSCompliant(false)]
|
||||
[ComVisible(false)]
|
||||
public unsafe override int GetChars(byte* bytes, int byteCount, char* chars, int charCount)
|
||||
{
|
||||
return base.GetChars(bytes, byteCount, chars, charCount);
|
||||
}
|
||||
|
||||
/// <summary>Decodes a range of bytes from a byte array into a string.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> containing the results of decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <param name="index">The index of the first byte to decode. </param>
|
||||
/// <param name="count">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003834 RID: 14388 RVA: 0x000C18DC File Offset: 0x000BFADC
|
||||
[ComVisible(false)]
|
||||
public override string GetString(byte[] bytes, int index, int count)
|
||||
{
|
||||
return base.GetString(bytes, index, count);
|
||||
}
|
||||
|
||||
// Token: 0x040016C2 RID: 5826
|
||||
internal const int UTF7_CODE_PAGE = 65000;
|
||||
|
||||
// Token: 0x040016C3 RID: 5827
|
||||
private const string base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
// Token: 0x040016C4 RID: 5828
|
||||
private bool allowOptionals;
|
||||
|
||||
// Token: 0x040016C5 RID: 5829
|
||||
private static readonly byte[] encodingRules = new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
|
||||
1, 0, 0, 1, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 1, 2, 2, 2, 2, 2, 2, 1,
|
||||
1, 1, 2, 3, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
|
||||
2, 2, 2, 1, 2, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 2, 0, 2, 2, 2, 2, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 2, 2, 2, 0, 0
|
||||
};
|
||||
|
||||
// Token: 0x040016C6 RID: 5830
|
||||
private static readonly sbyte[] base64Values = new sbyte[]
|
||||
{
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, 62, -1, -1, -1, 63, 52, 53,
|
||||
54, 55, 56, 57, 58, 59, 60, 61, -1, -1,
|
||||
-1, -1, -1, -1, -1, 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
|
||||
25, -1, -1, -1, -1, -1, -1, 26, 27, 28,
|
||||
29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
|
||||
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
|
||||
49, 50, 51, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1
|
||||
};
|
||||
|
||||
// Token: 0x020005FF RID: 1535
|
||||
private sealed class UTF7Decoder : Decoder
|
||||
{
|
||||
// Token: 0x06003835 RID: 14389 RVA: 0x000C18E8 File Offset: 0x000BFAE8
|
||||
public UTF7Decoder()
|
||||
{
|
||||
this.leftOver = 0;
|
||||
}
|
||||
|
||||
// Token: 0x06003836 RID: 14390 RVA: 0x000C18F8 File Offset: 0x000BFAF8
|
||||
public override int GetCharCount(byte[] bytes, int index, int count)
|
||||
{
|
||||
return UTF7Encoding.InternalGetCharCount(bytes, index, count, this.leftOver);
|
||||
}
|
||||
|
||||
// Token: 0x06003837 RID: 14391 RVA: 0x000C1908 File Offset: 0x000BFB08
|
||||
public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
|
||||
{
|
||||
return UTF7Encoding.InternalGetChars(bytes, byteIndex, byteCount, chars, charIndex, ref this.leftOver);
|
||||
}
|
||||
|
||||
// Token: 0x040016C7 RID: 5831
|
||||
private int leftOver;
|
||||
}
|
||||
|
||||
// Token: 0x02000600 RID: 1536
|
||||
private sealed class UTF7Encoder : Encoder
|
||||
{
|
||||
// Token: 0x06003838 RID: 14392 RVA: 0x000C191C File Offset: 0x000BFB1C
|
||||
public UTF7Encoder(bool allowOptionals)
|
||||
{
|
||||
this.allowOptionals = allowOptionals;
|
||||
}
|
||||
|
||||
// Token: 0x06003839 RID: 14393 RVA: 0x000C192C File Offset: 0x000BFB2C
|
||||
public override int GetByteCount(char[] chars, int index, int count, bool flush)
|
||||
{
|
||||
return UTF7Encoding.InternalGetByteCount(chars, index, count, flush, this.leftOver, this.isInShifted, this.allowOptionals);
|
||||
}
|
||||
|
||||
// Token: 0x0600383A RID: 14394 RVA: 0x000C194C File Offset: 0x000BFB4C
|
||||
public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, bool flush)
|
||||
{
|
||||
return UTF7Encoding.InternalGetBytes(chars, charIndex, charCount, bytes, byteIndex, flush, ref this.leftOver, ref this.isInShifted, this.allowOptionals);
|
||||
}
|
||||
|
||||
// Token: 0x040016C8 RID: 5832
|
||||
private bool allowOptionals;
|
||||
|
||||
// Token: 0x040016C9 RID: 5833
|
||||
private int leftOver;
|
||||
|
||||
// Token: 0x040016CA RID: 5834
|
||||
private bool isInShifted;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,1177 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Represents a UTF-8 encoding of Unicode characters.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x02000601 RID: 1537
|
||||
[MonoTODO("Serialization format not compatible with .NET")]
|
||||
[ComVisible(true)]
|
||||
[MonoTODO("EncoderFallback is not handled")]
|
||||
[Serializable]
|
||||
public class UTF8Encoding : Encoding
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.UTF8Encoding" /> class.</summary>
|
||||
// Token: 0x0600383B RID: 14395 RVA: 0x000C197C File Offset: 0x000BFB7C
|
||||
public UTF8Encoding()
|
||||
: this(false, false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.UTF8Encoding" /> class. A parameter specifies whether to provide a Unicode byte order mark.</summary>
|
||||
/// <param name="encoderShouldEmitUTF8Identifier">true to specify that a Unicode byte order mark is provided; otherwise, false. </param>
|
||||
// Token: 0x0600383C RID: 14396 RVA: 0x000C1988 File Offset: 0x000BFB88
|
||||
public UTF8Encoding(bool encoderShouldEmitUTF8Identifier)
|
||||
: this(encoderShouldEmitUTF8Identifier, false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.UTF8Encoding" /> class. Parameters specify whether to provide a Unicode byte order mark and whether to throw an exception when an invalid encoding is detected.</summary>
|
||||
/// <param name="encoderShouldEmitUTF8Identifier">true to specify that a Unicode byte order mark is provided; otherwise, false. </param>
|
||||
/// <param name="throwOnInvalidBytes">true to specify that an exception be thrown when an invalid encoding is detected; otherwise, false. </param>
|
||||
// Token: 0x0600383D RID: 14397 RVA: 0x000C1994 File Offset: 0x000BFB94
|
||||
public UTF8Encoding(bool encoderShouldEmitUTF8Identifier, bool throwOnInvalidBytes)
|
||||
: base(65001)
|
||||
{
|
||||
this.emitIdentifier = encoderShouldEmitUTF8Identifier;
|
||||
if (throwOnInvalidBytes)
|
||||
{
|
||||
base.SetFallbackInternal(null, DecoderFallback.ExceptionFallback);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.SetFallbackInternal(null, DecoderFallback.StandardSafeFallback);
|
||||
}
|
||||
this.web_name = (this.body_name = (this.header_name = "utf-8"));
|
||||
this.encoding_name = "Unicode (UTF-8)";
|
||||
this.is_browser_save = true;
|
||||
this.is_browser_display = true;
|
||||
this.is_mail_news_display = true;
|
||||
this.is_mail_news_save = true;
|
||||
this.windows_code_page = 1200;
|
||||
}
|
||||
|
||||
// Token: 0x0600383E RID: 14398 RVA: 0x000C1A28 File Offset: 0x000BFC28
|
||||
private unsafe static int InternalGetByteCount(char[] chars, int index, int count, ref char leftOver, bool flush)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (index < 0 || index > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (count < 0 || count > chars.Length - index)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (index != chars.Length)
|
||||
{
|
||||
fixed (char* ptr = (ref chars != null && chars.Length != 0 ? ref chars[0] : ref *null))
|
||||
{
|
||||
return UTF8Encoding.InternalGetByteCount(ptr + index, count, ref leftOver, flush);
|
||||
}
|
||||
}
|
||||
if (flush && leftOver != '\0')
|
||||
{
|
||||
leftOver = '\0';
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Token: 0x0600383F RID: 14399 RVA: 0x000C1ADC File Offset: 0x000BFCDC
|
||||
private unsafe static int InternalGetByteCount(char* chars, int count, ref char leftOver, bool flush)
|
||||
{
|
||||
int num = 0;
|
||||
char* ptr = chars + count;
|
||||
while (chars < ptr)
|
||||
{
|
||||
if (leftOver == '\0')
|
||||
{
|
||||
while (chars < ptr)
|
||||
{
|
||||
if (*chars < '\u0080')
|
||||
{
|
||||
num++;
|
||||
}
|
||||
else if (*chars < 'ࠀ')
|
||||
{
|
||||
num += 2;
|
||||
}
|
||||
else if (*chars < '\ud800' || *chars > '\udfff')
|
||||
{
|
||||
num += 3;
|
||||
}
|
||||
else if (*chars <= '\udbff')
|
||||
{
|
||||
if (chars + 1 >= ptr || chars[1] < '\udc00' || chars[1] > '\udfff')
|
||||
{
|
||||
leftOver = *chars;
|
||||
chars++;
|
||||
break;
|
||||
}
|
||||
num += 4;
|
||||
chars++;
|
||||
}
|
||||
else
|
||||
{
|
||||
num += 3;
|
||||
leftOver = '\0';
|
||||
}
|
||||
chars++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*chars >= '\udc00' && *chars <= '\udfff')
|
||||
{
|
||||
num += 4;
|
||||
chars++;
|
||||
}
|
||||
else
|
||||
{
|
||||
num += 3;
|
||||
}
|
||||
leftOver = '\0';
|
||||
}
|
||||
}
|
||||
if (flush && leftOver != '\0')
|
||||
{
|
||||
num += 3;
|
||||
leftOver = '\0';
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of bytes produced by encoding a set of characters from the specified character array.</summary>
|
||||
/// <returns>The number of bytes produced by encoding the specified characters.</returns>
|
||||
/// <param name="chars">The character array containing the set of characters to encode. </param>
|
||||
/// <param name="index">The index of the first character to encode. </param>
|
||||
/// <param name="count">The number of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="chars" />.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="chars" /> contains an invalid sequence of characters. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003840 RID: 14400 RVA: 0x000C1C00 File Offset: 0x000BFE00
|
||||
public override int GetByteCount(char[] chars, int index, int count)
|
||||
{
|
||||
char c = '\0';
|
||||
return UTF8Encoding.InternalGetByteCount(chars, index, count, ref c, true);
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of bytes produced by encoding a set of characters starting at the specified character pointer.</summary>
|
||||
/// <returns>The number of bytes produced by encoding the specified characters.</returns>
|
||||
/// <param name="chars">A pointer to the first character to encode. </param>
|
||||
/// <param name="count">The number of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="count" /> is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="chars" /> contains an invalid sequence of characters. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003841 RID: 14401 RVA: 0x000C1C1C File Offset: 0x000BFE1C
|
||||
[CLSCompliant(false)]
|
||||
[ComVisible(false)]
|
||||
public unsafe override int GetByteCount(char* chars, int count)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (count == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
char c = '\0';
|
||||
return UTF8Encoding.InternalGetByteCount(chars, count, ref c, true);
|
||||
}
|
||||
|
||||
// Token: 0x06003842 RID: 14402 RVA: 0x000C1C50 File Offset: 0x000BFE50
|
||||
private unsafe static int InternalGetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, ref char leftOver, bool flush)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (charIndex < 0 || charIndex > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charCount < 0 || charCount > chars.Length - charIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charIndex == chars.Length)
|
||||
{
|
||||
if (flush && leftOver != '\0')
|
||||
{
|
||||
leftOver = '\0';
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
fixed (char* ptr = (ref chars != null && chars.Length != 0 ? ref chars[0] : ref *null))
|
||||
{
|
||||
if (bytes.Length == byteIndex)
|
||||
{
|
||||
return UTF8Encoding.InternalGetBytes(ptr + charIndex, charCount, null, 0, ref leftOver, flush);
|
||||
}
|
||||
fixed (byte* ptr2 = (ref bytes != null && bytes.Length != 0 ? ref bytes[0] : ref *null))
|
||||
{
|
||||
return UTF8Encoding.InternalGetBytes(ptr + charIndex, charCount, ptr2 + byteIndex, bytes.Length - byteIndex, ref leftOver, flush);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06003843 RID: 14403 RVA: 0x000C1D80 File Offset: 0x000BFF80
|
||||
private unsafe static int InternalGetBytes(char* chars, int count, byte* bytes, int bcount, ref char leftOver, bool flush)
|
||||
{
|
||||
char* ptr = chars + count;
|
||||
byte* ptr2 = bytes + bcount;
|
||||
while (chars < ptr)
|
||||
{
|
||||
if (leftOver == '\0')
|
||||
{
|
||||
while (chars < ptr)
|
||||
{
|
||||
int num = (int)(*chars);
|
||||
if (num < 128)
|
||||
{
|
||||
if (bytes >= ptr2)
|
||||
{
|
||||
goto IL_29B;
|
||||
}
|
||||
*(bytes++) = (byte)num;
|
||||
}
|
||||
else if (num < 2048)
|
||||
{
|
||||
if (bytes + 1 >= ptr2)
|
||||
{
|
||||
goto IL_29B;
|
||||
}
|
||||
*bytes = (byte)(192 | (num >> 6));
|
||||
bytes[1] = (byte)(128 | (num & 63));
|
||||
bytes += 2;
|
||||
}
|
||||
else if (num < 55296 || num > 57343)
|
||||
{
|
||||
if (bytes + 2 >= ptr2)
|
||||
{
|
||||
goto IL_29B;
|
||||
}
|
||||
*bytes = (byte)(224 | (num >> 12));
|
||||
bytes[1] = (byte)(128 | ((num >> 6) & 63));
|
||||
bytes[2] = (byte)(128 | (num & 63));
|
||||
bytes += 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num <= 56319)
|
||||
{
|
||||
leftOver = *chars;
|
||||
chars++;
|
||||
break;
|
||||
}
|
||||
if (bytes + 2 >= ptr2)
|
||||
{
|
||||
goto IL_29B;
|
||||
}
|
||||
*bytes = (byte)(224 | (num >> 12));
|
||||
bytes[1] = (byte)(128 | ((num >> 6) & 63));
|
||||
bytes[2] = (byte)(128 | (num & 63));
|
||||
bytes += 3;
|
||||
leftOver = '\0';
|
||||
}
|
||||
chars++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (*chars >= '\udc00' && *chars <= '\udfff')
|
||||
{
|
||||
int num2 = 65536 + (int)(*chars) - 56320 + (int)((int)(leftOver - '\ud800') << 10);
|
||||
if (bytes + 3 >= ptr2)
|
||||
{
|
||||
goto IL_29B;
|
||||
}
|
||||
*bytes = (byte)(240 | (num2 >> 18));
|
||||
bytes[1] = (byte)(128 | ((num2 >> 12) & 63));
|
||||
bytes[2] = (byte)(128 | ((num2 >> 6) & 63));
|
||||
bytes[3] = (byte)(128 | (num2 & 63));
|
||||
bytes += 4;
|
||||
chars++;
|
||||
}
|
||||
else
|
||||
{
|
||||
int num3 = (int)leftOver;
|
||||
if (bytes + 2 >= ptr2)
|
||||
{
|
||||
goto IL_29B;
|
||||
}
|
||||
*bytes = (byte)(224 | (num3 >> 12));
|
||||
bytes[1] = (byte)(128 | ((num3 >> 6) & 63));
|
||||
bytes[2] = (byte)(128 | (num3 & 63));
|
||||
bytes += 3;
|
||||
}
|
||||
leftOver = '\0';
|
||||
continue;
|
||||
IL_29B:
|
||||
throw new ArgumentException("Insufficient Space", "bytes");
|
||||
}
|
||||
if (flush && leftOver != '\0')
|
||||
{
|
||||
int num4 = (int)leftOver;
|
||||
if (bytes + 2 >= ptr2)
|
||||
{
|
||||
goto IL_29B;
|
||||
}
|
||||
*bytes = (byte)(224 | (num4 >> 12));
|
||||
bytes[1] = (byte)(128 | ((num4 >> 6) & 63));
|
||||
bytes[2] = (byte)(128 | (num4 & 63));
|
||||
bytes += 3;
|
||||
leftOver = '\0';
|
||||
}
|
||||
return (int)((long)(bytes - (ptr2 - bcount)));
|
||||
}
|
||||
|
||||
/// <summary>Encodes a set of characters from the specified character array into the specified byte array.</summary>
|
||||
/// <returns>The actual number of bytes written into <paramref name="bytes" />.</returns>
|
||||
/// <param name="chars">The character array containing the set of characters to encode. </param>
|
||||
/// <param name="charIndex">The index of the first character to encode. </param>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <param name="bytes">The byte array to contain the resulting sequence of bytes. </param>
|
||||
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null.-or- <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charIndex" /> or <paramref name="charCount" /> or <paramref name="byteIndex" /> is less than zero.-or- <paramref name="charIndex" /> and <paramref name="charCount" /> do not denote a valid range in <paramref name="chars" />.-or- <paramref name="byteIndex" /> is not a valid index in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="chars" /> contains an invalid sequence of characters.-or- <paramref name="bytes" /> does not have enough capacity from <paramref name="byteIndex" /> to the end of the array to accommodate the resulting bytes. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003844 RID: 14404 RVA: 0x000C2038 File Offset: 0x000C0238
|
||||
public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex)
|
||||
{
|
||||
char c = '\0';
|
||||
return UTF8Encoding.InternalGetBytes(chars, charIndex, charCount, bytes, byteIndex, ref c, true);
|
||||
}
|
||||
|
||||
/// <summary>Encodes a set of characters from the specified <see cref="T:System.String" /> into the specified byte array.</summary>
|
||||
/// <returns>The actual number of bytes written into <paramref name="bytes" />.</returns>
|
||||
/// <param name="s">The <see cref="T:System.String" /> containing the set of characters to encode. </param>
|
||||
/// <param name="charIndex">The index of the first character to encode. </param>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <param name="bytes">The byte array to contain the resulting sequence of bytes. </param>
|
||||
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="s" /> is null.-or- <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charIndex" /> or <paramref name="charCount" /> or <paramref name="byteIndex" /> is less than zero.-or- <paramref name="charIndex" /> and <paramref name="charCount" /> do not denote a valid range in <paramref name="chars" />.-or- <paramref name="byteIndex" /> is not a valid index in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="s" /> contains an invalid sequence of characters.-or- <paramref name="bytes" /> does not have enough capacity from <paramref name="byteIndex" /> to the end of the array to accommodate the resulting bytes. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003845 RID: 14405 RVA: 0x000C2058 File Offset: 0x000C0258
|
||||
public unsafe override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex)
|
||||
{
|
||||
if (s == null)
|
||||
{
|
||||
throw new ArgumentNullException("s");
|
||||
}
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (charIndex < 0 || charIndex > s.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex", Encoding._("ArgRange_StringIndex"));
|
||||
}
|
||||
if (charCount < 0 || charCount > s.Length - charIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount", Encoding._("ArgRange_StringRange"));
|
||||
}
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charIndex == s.Length)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
fixed (char* ptr = s + RuntimeHelpers.OffsetToStringData / 2)
|
||||
{
|
||||
char c = '\0';
|
||||
if (bytes.Length == byteIndex)
|
||||
{
|
||||
return UTF8Encoding.InternalGetBytes(ptr + charIndex, charCount, null, 0, ref c, true);
|
||||
}
|
||||
fixed (byte* ptr2 = (ref bytes != null && bytes.Length != 0 ? ref bytes[0] : ref *null))
|
||||
{
|
||||
return UTF8Encoding.InternalGetBytes(ptr + charIndex, charCount, ptr2 + byteIndex, bytes.Length - byteIndex, ref c, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Encodes a set of characters starting at the specified character pointer into a sequence of bytes that are stored starting at the specified byte pointer.</summary>
|
||||
/// <returns>The actual number of bytes written at the location indicated by <paramref name="bytes" />.</returns>
|
||||
/// <param name="chars">A pointer to the first character to encode. </param>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <param name="bytes">A pointer to the location at which to start writing the resulting sequence of bytes. </param>
|
||||
/// <param name="byteCount">The maximum number of bytes to write. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null.-or- <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charCount" /> or <paramref name="byteCount" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="chars" /> contains an invalid sequence of characters.-or- <paramref name="byteCount" /> is less than the resulting number of bytes. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003846 RID: 14406 RVA: 0x000C2174 File Offset: 0x000C0374
|
||||
[CLSCompliant(false)]
|
||||
[ComVisible(false)]
|
||||
public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (charCount < 0)
|
||||
{
|
||||
throw new IndexOutOfRangeException("charCount");
|
||||
}
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (byteCount < 0)
|
||||
{
|
||||
throw new IndexOutOfRangeException("charCount");
|
||||
}
|
||||
if (charCount == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
char c = '\0';
|
||||
if (byteCount == 0)
|
||||
{
|
||||
return UTF8Encoding.InternalGetBytes(chars, charCount, null, 0, ref c, true);
|
||||
}
|
||||
return UTF8Encoding.InternalGetBytes(chars, charCount, bytes, byteCount, ref c, true);
|
||||
}
|
||||
|
||||
// Token: 0x06003847 RID: 14407 RVA: 0x000C21F4 File Offset: 0x000C03F4
|
||||
private unsafe static int InternalGetCharCount(byte[] bytes, int index, int count, uint leftOverBits, uint leftOverCount, object provider, ref DecoderFallbackBuffer fallbackBuffer, ref byte[] bufferArg, bool flush)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (index < 0 || index > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (count < 0 || count > bytes.Length - index)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (count == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
fixed (byte* ptr = (ref bytes != null && bytes.Length != 0 ? ref bytes[0] : ref *null))
|
||||
{
|
||||
return UTF8Encoding.InternalGetCharCount(ptr + index, count, leftOverBits, leftOverCount, provider, ref fallbackBuffer, ref bufferArg, flush);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06003848 RID: 14408 RVA: 0x000C2298 File Offset: 0x000C0498
|
||||
private unsafe static int InternalGetCharCount(byte* bytes, int count, uint leftOverBits, uint leftOverCount, object provider, ref DecoderFallbackBuffer fallbackBuffer, ref byte[] bufferArg, bool flush)
|
||||
{
|
||||
int i = 0;
|
||||
int num = 0;
|
||||
if (leftOverCount == 0U)
|
||||
{
|
||||
int num2 = i + count;
|
||||
while (i < num2)
|
||||
{
|
||||
if (bytes[i] >= 128)
|
||||
{
|
||||
break;
|
||||
}
|
||||
num++;
|
||||
i++;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
uint num3 = leftOverBits;
|
||||
uint num4 = leftOverCount & 15U;
|
||||
uint num5 = (leftOverCount >> 4) & 15U;
|
||||
while (count > 0)
|
||||
{
|
||||
uint num6 = (uint)bytes[i++];
|
||||
count--;
|
||||
if (num5 == 0U)
|
||||
{
|
||||
if (num6 < 128U)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
else if ((num6 & 224U) == 192U)
|
||||
{
|
||||
num3 = num6 & 31U;
|
||||
num4 = 1U;
|
||||
num5 = 2U;
|
||||
}
|
||||
else if ((num6 & 240U) == 224U)
|
||||
{
|
||||
num3 = num6 & 15U;
|
||||
num4 = 1U;
|
||||
num5 = 3U;
|
||||
}
|
||||
else if ((num6 & 248U) == 240U)
|
||||
{
|
||||
num3 = num6 & 7U;
|
||||
num4 = 1U;
|
||||
num5 = 4U;
|
||||
}
|
||||
else if ((num6 & 252U) == 248U)
|
||||
{
|
||||
num3 = num6 & 3U;
|
||||
num4 = 1U;
|
||||
num5 = 5U;
|
||||
}
|
||||
else if ((num6 & 254U) == 252U)
|
||||
{
|
||||
num3 = num6 & 3U;
|
||||
num4 = 1U;
|
||||
num5 = 6U;
|
||||
}
|
||||
else
|
||||
{
|
||||
num += UTF8Encoding.Fallback(provider, ref fallbackBuffer, ref bufferArg, bytes, (long)(i - 1), 1U);
|
||||
}
|
||||
}
|
||||
else if ((num6 & 192U) == 128U)
|
||||
{
|
||||
num3 = (num3 << 6) | (num6 & 63U);
|
||||
if ((num4 += 1U) >= num5)
|
||||
{
|
||||
if (num3 < 65536U)
|
||||
{
|
||||
bool flag = false;
|
||||
switch (num5)
|
||||
{
|
||||
case 2U:
|
||||
flag = num3 <= 127U;
|
||||
break;
|
||||
case 3U:
|
||||
flag = num3 <= 2047U;
|
||||
break;
|
||||
case 4U:
|
||||
flag = num3 <= 65535U;
|
||||
break;
|
||||
case 5U:
|
||||
flag = num3 <= 2097151U;
|
||||
break;
|
||||
case 6U:
|
||||
flag = num3 <= 67108863U;
|
||||
break;
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
num += UTF8Encoding.Fallback(provider, ref fallbackBuffer, ref bufferArg, bytes, (long)i - (long)((ulong)num4), num4);
|
||||
}
|
||||
else if ((num3 & 63488U) == 55296U)
|
||||
{
|
||||
num += UTF8Encoding.Fallback(provider, ref fallbackBuffer, ref bufferArg, bytes, (long)i - (long)((ulong)num4), num4);
|
||||
}
|
||||
else
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
else if (num3 < 1114112U)
|
||||
{
|
||||
num += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
num += UTF8Encoding.Fallback(provider, ref fallbackBuffer, ref bufferArg, bytes, (long)i - (long)((ulong)num4), num4);
|
||||
}
|
||||
num5 = 0U;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
num += UTF8Encoding.Fallback(provider, ref fallbackBuffer, ref bufferArg, bytes, (long)i - (long)((ulong)num4), num4);
|
||||
num5 = 0U;
|
||||
i--;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (flush && num5 != 0U)
|
||||
{
|
||||
num += UTF8Encoding.Fallback(provider, ref fallbackBuffer, ref bufferArg, bytes, (long)i - (long)((ulong)num4), num4);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06003849 RID: 14409 RVA: 0x000C257C File Offset: 0x000C077C
|
||||
private unsafe static int Fallback(object provider, ref DecoderFallbackBuffer buffer, ref byte[] bufferArg, byte* bytes, long index, uint size)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
DecoderFallback decoderFallback = provider as DecoderFallback;
|
||||
if (decoderFallback != null)
|
||||
{
|
||||
buffer = decoderFallback.CreateFallbackBuffer();
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer = ((Decoder)provider).FallbackBuffer;
|
||||
}
|
||||
}
|
||||
if (bufferArg == null)
|
||||
{
|
||||
bufferArg = new byte[1];
|
||||
}
|
||||
int num = 0;
|
||||
int num2 = 0;
|
||||
while ((long)num2 < (long)((ulong)size))
|
||||
{
|
||||
bufferArg[0] = bytes[(int)index + num2];
|
||||
buffer.Fallback(bufferArg, 0);
|
||||
num += buffer.Remaining;
|
||||
buffer.Reset();
|
||||
num2++;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x0600384A RID: 14410 RVA: 0x000C2608 File Offset: 0x000C0808
|
||||
private unsafe static void Fallback(object provider, ref DecoderFallbackBuffer buffer, ref byte[] bufferArg, byte* bytes, long byteIndex, uint size, char* chars, ref int charIndex)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
DecoderFallback decoderFallback = provider as DecoderFallback;
|
||||
if (decoderFallback != null)
|
||||
{
|
||||
buffer = decoderFallback.CreateFallbackBuffer();
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer = ((Decoder)provider).FallbackBuffer;
|
||||
}
|
||||
}
|
||||
if (bufferArg == null)
|
||||
{
|
||||
bufferArg = new byte[1];
|
||||
}
|
||||
int num = 0;
|
||||
while ((long)num < (long)((ulong)size))
|
||||
{
|
||||
bufferArg[0] = bytes[byteIndex + (long)num];
|
||||
buffer.Fallback(bufferArg, 0);
|
||||
while (buffer.Remaining > 0)
|
||||
{
|
||||
chars[charIndex++] = buffer.GetNextChar();
|
||||
}
|
||||
buffer.Reset();
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.</summary>
|
||||
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <param name="index">The index of the first byte to decode. </param>
|
||||
/// <param name="count">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="bytes" />.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="bytes" /> contains an invalid sequence of bytes. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600384B RID: 14411 RVA: 0x000C26B0 File Offset: 0x000C08B0
|
||||
public override int GetCharCount(byte[] bytes, int index, int count)
|
||||
{
|
||||
DecoderFallbackBuffer decoderFallbackBuffer = null;
|
||||
byte[] array = null;
|
||||
return UTF8Encoding.InternalGetCharCount(bytes, index, count, 0U, 0U, base.DecoderFallback, ref decoderFallbackBuffer, ref array, true);
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of characters produced by decoding a sequence of bytes starting at the specified byte pointer.</summary>
|
||||
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes"></param>
|
||||
/// <param name="count"></param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="count" /> is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="bytes" /> contains an invalid sequence of bytes. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600384C RID: 14412 RVA: 0x000C26D8 File Offset: 0x000C08D8
|
||||
[CLSCompliant(false)]
|
||||
[ComVisible(false)]
|
||||
public unsafe override int GetCharCount(byte* bytes, int count)
|
||||
{
|
||||
DecoderFallbackBuffer decoderFallbackBuffer = null;
|
||||
byte[] array = null;
|
||||
return UTF8Encoding.InternalGetCharCount(bytes, count, 0U, 0U, base.DecoderFallback, ref decoderFallbackBuffer, ref array, true);
|
||||
}
|
||||
|
||||
// Token: 0x0600384D RID: 14413 RVA: 0x000C2700 File Offset: 0x000C0900
|
||||
private unsafe static int InternalGetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, ref uint leftOverBits, ref uint leftOverCount, object provider, ref DecoderFallbackBuffer fallbackBuffer, ref byte[] bufferArg, bool flush)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (byteCount < 0 || byteCount > bytes.Length - byteIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charIndex < 0 || charIndex > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charIndex == chars.Length)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
fixed (char* ptr = (ref chars != null && chars.Length != 0 ? ref chars[0] : ref *null))
|
||||
{
|
||||
if (byteCount == 0 || byteIndex == bytes.Length)
|
||||
{
|
||||
return UTF8Encoding.InternalGetChars(null, 0, ptr + charIndex, chars.Length - charIndex, ref leftOverBits, ref leftOverCount, provider, ref fallbackBuffer, ref bufferArg, flush);
|
||||
}
|
||||
fixed (byte* ptr2 = (ref bytes != null && bytes.Length != 0 ? ref bytes[0] : ref *null))
|
||||
{
|
||||
return UTF8Encoding.InternalGetChars(ptr2 + byteIndex, byteCount, ptr + charIndex, chars.Length - charIndex, ref leftOverBits, ref leftOverCount, provider, ref fallbackBuffer, ref bufferArg, flush);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600384E RID: 14414 RVA: 0x000C283C File Offset: 0x000C0A3C
|
||||
private unsafe static int InternalGetChars(byte* bytes, int byteCount, char* chars, int charCount, ref uint leftOverBits, ref uint leftOverCount, object provider, ref DecoderFallbackBuffer fallbackBuffer, ref byte[] bufferArg, bool flush)
|
||||
{
|
||||
int num = 0;
|
||||
int i = 0;
|
||||
int num2 = num;
|
||||
if (leftOverCount == 0U)
|
||||
{
|
||||
int num3 = i + byteCount;
|
||||
while (i < num3)
|
||||
{
|
||||
if (bytes[i] >= 128)
|
||||
{
|
||||
break;
|
||||
}
|
||||
chars[num2] = (char)bytes[i];
|
||||
num2++;
|
||||
i++;
|
||||
byteCount--;
|
||||
}
|
||||
}
|
||||
uint num4 = leftOverBits;
|
||||
uint num5 = leftOverCount & 15U;
|
||||
uint num6 = (leftOverCount >> 4) & 15U;
|
||||
int num7 = i + byteCount;
|
||||
while (i < num7)
|
||||
{
|
||||
uint num8 = (uint)bytes[i];
|
||||
if (num6 == 0U)
|
||||
{
|
||||
if (num8 < 128U)
|
||||
{
|
||||
if (num2 >= charCount)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"), "chars");
|
||||
}
|
||||
chars[num2++] = (char)num8;
|
||||
}
|
||||
else if ((num8 & 224U) == 192U)
|
||||
{
|
||||
num4 = num8 & 31U;
|
||||
num5 = 1U;
|
||||
num6 = 2U;
|
||||
}
|
||||
else if ((num8 & 240U) == 224U)
|
||||
{
|
||||
num4 = num8 & 15U;
|
||||
num5 = 1U;
|
||||
num6 = 3U;
|
||||
}
|
||||
else if ((num8 & 248U) == 240U)
|
||||
{
|
||||
num4 = num8 & 7U;
|
||||
num5 = 1U;
|
||||
num6 = 4U;
|
||||
}
|
||||
else if ((num8 & 252U) == 248U)
|
||||
{
|
||||
num4 = num8 & 3U;
|
||||
num5 = 1U;
|
||||
num6 = 5U;
|
||||
}
|
||||
else if ((num8 & 254U) == 252U)
|
||||
{
|
||||
num4 = num8 & 3U;
|
||||
num5 = 1U;
|
||||
num6 = 6U;
|
||||
}
|
||||
else
|
||||
{
|
||||
UTF8Encoding.Fallback(provider, ref fallbackBuffer, ref bufferArg, bytes, (long)i, 1U, chars, ref num2);
|
||||
}
|
||||
}
|
||||
else if ((num8 & 192U) == 128U)
|
||||
{
|
||||
num4 = (num4 << 6) | (num8 & 63U);
|
||||
if ((num5 += 1U) >= num6)
|
||||
{
|
||||
if (num4 < 65536U)
|
||||
{
|
||||
bool flag = false;
|
||||
switch (num6)
|
||||
{
|
||||
case 2U:
|
||||
flag = num4 <= 127U;
|
||||
break;
|
||||
case 3U:
|
||||
flag = num4 <= 2047U;
|
||||
break;
|
||||
case 4U:
|
||||
flag = num4 <= 65535U;
|
||||
break;
|
||||
case 5U:
|
||||
flag = num4 <= 2097151U;
|
||||
break;
|
||||
case 6U:
|
||||
flag = num4 <= 67108863U;
|
||||
break;
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
UTF8Encoding.Fallback(provider, ref fallbackBuffer, ref bufferArg, bytes, (long)i - (long)((ulong)num5), num5, chars, ref num2);
|
||||
}
|
||||
else if ((num4 & 63488U) == 55296U)
|
||||
{
|
||||
UTF8Encoding.Fallback(provider, ref fallbackBuffer, ref bufferArg, bytes, (long)i - (long)((ulong)num5), num5, chars, ref num2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num2 >= charCount)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"), "chars");
|
||||
}
|
||||
chars[num2++] = (char)num4;
|
||||
}
|
||||
}
|
||||
else if (num4 < 1114112U)
|
||||
{
|
||||
if (num2 + 2 > charCount)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"), "chars");
|
||||
}
|
||||
num4 -= 65536U;
|
||||
chars[num2++] = (char)((num4 >> 10) + 55296U);
|
||||
chars[num2++] = (char)((num4 & 1023U) + 56320U);
|
||||
}
|
||||
else
|
||||
{
|
||||
UTF8Encoding.Fallback(provider, ref fallbackBuffer, ref bufferArg, bytes, (long)i - (long)((ulong)num5), num5, chars, ref num2);
|
||||
}
|
||||
num6 = 0U;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UTF8Encoding.Fallback(provider, ref fallbackBuffer, ref bufferArg, bytes, (long)i - (long)((ulong)num5), num5, chars, ref num2);
|
||||
num6 = 0U;
|
||||
i--;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (flush && num6 != 0U)
|
||||
{
|
||||
UTF8Encoding.Fallback(provider, ref fallbackBuffer, ref bufferArg, bytes, (long)i - (long)((ulong)num5), num5, chars, ref num2);
|
||||
}
|
||||
leftOverBits = num4;
|
||||
leftOverCount = num5 | (num6 << 4);
|
||||
return num2 - num;
|
||||
}
|
||||
|
||||
/// <summary>Decodes a sequence of bytes from the specified byte array into the specified character array.</summary>
|
||||
/// <returns>The actual number of characters written into <paramref name="chars" />.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <param name="byteIndex">The index of the first byte to decode. </param>
|
||||
/// <param name="byteCount">The number of bytes to decode. </param>
|
||||
/// <param name="chars">The character array to contain the resulting set of characters. </param>
|
||||
/// <param name="charIndex">The index at which to start writing the resulting set of characters. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null.-or- <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteIndex" /> or <paramref name="byteCount" /> or <paramref name="charIndex" /> is less than zero.-or- <paramref name="byteindex" /> and <paramref name="byteCount" /> do not denote a valid range in <paramref name="bytes" />.-or- <paramref name="charIndex" /> is not a valid index in <paramref name="chars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="bytes" /> contains an invalid sequence of bytes.-or- <paramref name="chars" /> does not have enough capacity from <paramref name="charIndex" /> to the end of the array to accommodate the resulting characters. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600384F RID: 14415 RVA: 0x000C2BF0 File Offset: 0x000C0DF0
|
||||
public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
|
||||
{
|
||||
uint num = 0U;
|
||||
uint num2 = 0U;
|
||||
DecoderFallbackBuffer decoderFallbackBuffer = null;
|
||||
byte[] array = null;
|
||||
return UTF8Encoding.InternalGetChars(bytes, byteIndex, byteCount, chars, charIndex, ref num, ref num2, base.DecoderFallback, ref decoderFallbackBuffer, ref array, true);
|
||||
}
|
||||
|
||||
/// <summary>Decodes a sequence of bytes starting at the specified byte pointer into a set of characters that are stored starting at the specified character pointer.</summary>
|
||||
/// <returns>The actual number of characters written at the location indicated by <paramref name="chars" />.</returns>
|
||||
/// <param name="bytes">A pointer to the first byte to decode. </param>
|
||||
/// <param name="byteCount">The number of bytes to decode. </param>
|
||||
/// <param name="chars">A pointer to the location at which to start writing the resulting set of characters. </param>
|
||||
/// <param name="charCount">The maximum number of characters to write. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null.-or- <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteCount" /> or <paramref name="charCount" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="bytes" /> contains an invalid sequence of bytes.-or- <paramref name="charCount" /> is less than the resulting number of characters. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003850 RID: 14416 RVA: 0x000C2C20 File Offset: 0x000C0E20
|
||||
[ComVisible(false)]
|
||||
[CLSCompliant(false)]
|
||||
public unsafe override int GetChars(byte* bytes, int byteCount, char* chars, int charCount)
|
||||
{
|
||||
DecoderFallbackBuffer decoderFallbackBuffer = null;
|
||||
byte[] array = null;
|
||||
uint num = 0U;
|
||||
uint num2 = 0U;
|
||||
return UTF8Encoding.InternalGetChars(bytes, byteCount, chars, charCount, ref num, ref num2, base.DecoderFallback, ref decoderFallbackBuffer, ref array, true);
|
||||
}
|
||||
|
||||
/// <summary>Calculates the maximum number of bytes produced by encoding the specified number of characters.</summary>
|
||||
/// <returns>The maximum number of bytes produced by encoding the specified number of characters.</returns>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charCount" /> is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003851 RID: 14417 RVA: 0x000C2C50 File Offset: 0x000C0E50
|
||||
public override int GetMaxByteCount(int charCount)
|
||||
{
|
||||
if (charCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount", Encoding._("ArgRange_NonNegative"));
|
||||
}
|
||||
return charCount * 4;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the maximum number of characters produced by decoding the specified number of bytes.</summary>
|
||||
/// <returns>The maximum number of characters produced by decoding the specified number of bytes.</returns>
|
||||
/// <param name="byteCount">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteCount" /> is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003852 RID: 14418 RVA: 0x000C2C74 File Offset: 0x000C0E74
|
||||
public override int GetMaxCharCount(int byteCount)
|
||||
{
|
||||
if (byteCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount", Encoding._("ArgRange_NonNegative"));
|
||||
}
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
/// <summary>Obtains a decoder that converts a UTF-8 encoded sequence of bytes into a sequence of Unicode characters.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.Decoder" /> that converts a UTF-8 encoded sequence of bytes into a sequence of Unicode characters.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003853 RID: 14419 RVA: 0x000C2C94 File Offset: 0x000C0E94
|
||||
public override Decoder GetDecoder()
|
||||
{
|
||||
return new UTF8Encoding.UTF8Decoder(base.DecoderFallback);
|
||||
}
|
||||
|
||||
/// <summary>Obtains an encoder that converts a sequence of Unicode characters into a UTF-8 encoded sequence of bytes.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.Encoder" /> that converts a sequence of Unicode characters into a UTF-8 encoded sequence of bytes.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003854 RID: 14420 RVA: 0x000C2CA4 File Offset: 0x000C0EA4
|
||||
public override Encoder GetEncoder()
|
||||
{
|
||||
return new UTF8Encoding.UTF8Encoder(this.emitIdentifier);
|
||||
}
|
||||
|
||||
/// <summary>Returns a Unicode byte order mark encoded in UTF-8 format, if the constructor for this instance requests a byte order mark.</summary>
|
||||
/// <returns>A byte array containing the Unicode byte order mark, if the constructor for this instance requests a byte order mark. Otherwise, this method returns a byte array of length zero.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003855 RID: 14421 RVA: 0x000C2CB4 File Offset: 0x000C0EB4
|
||||
public override byte[] GetPreamble()
|
||||
{
|
||||
if (this.emitIdentifier)
|
||||
{
|
||||
return new byte[] { 239, 187, 191 };
|
||||
}
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
/// <summary>Determines whether the specified <see cref="T:System.Object" /> is equal to the current <see cref="T:System.Text.UTF8Encoding" /> object.</summary>
|
||||
/// <returns>true if <paramref name="value" /> is an instance of <see cref="T:System.Text.UTF8Encoding" /> and is equal to the current object; otherwise, false.</returns>
|
||||
/// <param name="value">The <see cref="T:System.Object" /> to compare with the current instance. </param>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003856 RID: 14422 RVA: 0x000C2CF4 File Offset: 0x000C0EF4
|
||||
public override bool Equals(object value)
|
||||
{
|
||||
UTF8Encoding utf8Encoding = value as UTF8Encoding;
|
||||
return utf8Encoding != null && (this.codePage == utf8Encoding.codePage && this.emitIdentifier == utf8Encoding.emitIdentifier && base.DecoderFallback.Equals(utf8Encoding.DecoderFallback)) && base.EncoderFallback.Equals(utf8Encoding.EncoderFallback);
|
||||
}
|
||||
|
||||
/// <summary>Returns the hash code for the current instance.</summary>
|
||||
/// <returns>The hash code for the current instance.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003857 RID: 14423 RVA: 0x000C2D5C File Offset: 0x000C0F5C
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of bytes produced by encoding the characters in the specified <see cref="T:System.String" />.</summary>
|
||||
/// <returns>The number of bytes produced by encoding the specified characters.</returns>
|
||||
/// <param name="chars">The <see cref="T:System.String" /> containing the set of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="chars" /> contains an invalid sequence of characters. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003858 RID: 14424 RVA: 0x000C2D64 File Offset: 0x000C0F64
|
||||
public override int GetByteCount(string chars)
|
||||
{
|
||||
return base.GetByteCount(chars);
|
||||
}
|
||||
|
||||
/// <summary>Decodes a range of bytes from a byte array into a string.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> containing the results of decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <param name="index">The index of the first byte to decode. </param>
|
||||
/// <param name="count">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="bytes" /> contains an invalid sequence of bytes. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003859 RID: 14425 RVA: 0x000C2D70 File Offset: 0x000C0F70
|
||||
[ComVisible(false)]
|
||||
public override string GetString(byte[] bytes, int index, int count)
|
||||
{
|
||||
return base.GetString(bytes, index, count);
|
||||
}
|
||||
|
||||
// Token: 0x040016CB RID: 5835
|
||||
internal const int UTF8_CODE_PAGE = 65001;
|
||||
|
||||
// Token: 0x040016CC RID: 5836
|
||||
private bool emitIdentifier;
|
||||
|
||||
// Token: 0x02000602 RID: 1538
|
||||
[Serializable]
|
||||
private class UTF8Decoder : Decoder
|
||||
{
|
||||
// Token: 0x0600385A RID: 14426 RVA: 0x000C2D7C File Offset: 0x000C0F7C
|
||||
public UTF8Decoder(DecoderFallback fallback)
|
||||
{
|
||||
base.Fallback = fallback;
|
||||
this.leftOverBits = 0U;
|
||||
this.leftOverCount = 0U;
|
||||
}
|
||||
|
||||
// Token: 0x0600385B RID: 14427 RVA: 0x000C2D9C File Offset: 0x000C0F9C
|
||||
public override int GetCharCount(byte[] bytes, int index, int count)
|
||||
{
|
||||
DecoderFallbackBuffer decoderFallbackBuffer = null;
|
||||
byte[] array = null;
|
||||
return UTF8Encoding.InternalGetCharCount(bytes, index, count, this.leftOverBits, this.leftOverCount, this, ref decoderFallbackBuffer, ref array, false);
|
||||
}
|
||||
|
||||
// Token: 0x0600385C RID: 14428 RVA: 0x000C2DC8 File Offset: 0x000C0FC8
|
||||
public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
|
||||
{
|
||||
DecoderFallbackBuffer decoderFallbackBuffer = null;
|
||||
byte[] array = null;
|
||||
return UTF8Encoding.InternalGetChars(bytes, byteIndex, byteCount, chars, charIndex, ref this.leftOverBits, ref this.leftOverCount, this, ref decoderFallbackBuffer, ref array, false);
|
||||
}
|
||||
|
||||
// Token: 0x040016CD RID: 5837
|
||||
private uint leftOverBits;
|
||||
|
||||
// Token: 0x040016CE RID: 5838
|
||||
private uint leftOverCount;
|
||||
}
|
||||
|
||||
// Token: 0x02000603 RID: 1539
|
||||
[Serializable]
|
||||
private class UTF8Encoder : Encoder
|
||||
{
|
||||
// Token: 0x0600385D RID: 14429 RVA: 0x000C2DF8 File Offset: 0x000C0FF8
|
||||
public UTF8Encoder(bool emitIdentifier)
|
||||
{
|
||||
this.leftOverForCount = '\0';
|
||||
this.leftOverForConv = '\0';
|
||||
}
|
||||
|
||||
// Token: 0x0600385E RID: 14430 RVA: 0x000C2E10 File Offset: 0x000C1010
|
||||
public override int GetByteCount(char[] chars, int index, int count, bool flush)
|
||||
{
|
||||
return UTF8Encoding.InternalGetByteCount(chars, index, count, ref this.leftOverForCount, flush);
|
||||
}
|
||||
|
||||
// Token: 0x0600385F RID: 14431 RVA: 0x000C2E24 File Offset: 0x000C1024
|
||||
public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, bool flush)
|
||||
{
|
||||
return UTF8Encoding.InternalGetBytes(chars, charIndex, charCount, bytes, byteIndex, ref this.leftOverForConv, flush);
|
||||
}
|
||||
|
||||
// Token: 0x06003860 RID: 14432 RVA: 0x000C2E48 File Offset: 0x000C1048
|
||||
public unsafe override int GetByteCount(char* chars, int count, bool flush)
|
||||
{
|
||||
return UTF8Encoding.InternalGetByteCount(chars, count, ref this.leftOverForCount, flush);
|
||||
}
|
||||
|
||||
// Token: 0x06003861 RID: 14433 RVA: 0x000C2E58 File Offset: 0x000C1058
|
||||
public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount, bool flush)
|
||||
{
|
||||
return UTF8Encoding.InternalGetBytes(chars, charCount, bytes, byteCount, ref this.leftOverForConv, flush);
|
||||
}
|
||||
|
||||
// Token: 0x040016CF RID: 5839
|
||||
private char leftOverForCount;
|
||||
|
||||
// Token: 0x040016D0 RID: 5840
|
||||
private char leftOverForConv;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,862 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Text
|
||||
{
|
||||
/// <summary>Represents a UTF-16 encoding of Unicode characters.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x02000604 RID: 1540
|
||||
[ComVisible(true)]
|
||||
[MonoTODO("Serialization format not compatible with .NET")]
|
||||
[Serializable]
|
||||
public class UnicodeEncoding : Encoding
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.UnicodeEncoding" /> class.</summary>
|
||||
// Token: 0x06003862 RID: 14434 RVA: 0x000C2E7C File Offset: 0x000C107C
|
||||
public UnicodeEncoding()
|
||||
: this(false, true)
|
||||
{
|
||||
this.bigEndian = false;
|
||||
this.byteOrderMark = true;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.UnicodeEncoding" /> class. Parameters specify whether to use the big endian byte order and whether to provide a Unicode byte order mark.</summary>
|
||||
/// <param name="bigEndian">true to use the big endian byte order (most significant byte first), or false to use the little endian byte order (least significant byte first). </param>
|
||||
/// <param name="byteOrderMark">true to specify that a Unicode byte order mark is provided; otherwise, false. </param>
|
||||
// Token: 0x06003863 RID: 14435 RVA: 0x000C2E94 File Offset: 0x000C1094
|
||||
public UnicodeEncoding(bool bigEndian, bool byteOrderMark)
|
||||
: this(bigEndian, byteOrderMark, false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Text.UnicodeEncoding" /> class. Parameters specify whether to use the big endian byte order, whether to provide a Unicode byte order mark, and whether to throw an exception when an invalid encoding is detected.</summary>
|
||||
/// <param name="bigEndian">true to use the big endian byte order (most significant byte first); false to use the little endian byte order (least significant byte first). </param>
|
||||
/// <param name="byteOrderMark">true to specify that a Unicode byte order mark is provided; otherwise, false. </param>
|
||||
/// <param name="throwOnInvalidBytes">true to specify that an exception should be thrown when an invalid encoding is detected; otherwise, false. </param>
|
||||
// Token: 0x06003864 RID: 14436 RVA: 0x000C2EA0 File Offset: 0x000C10A0
|
||||
public UnicodeEncoding(bool bigEndian, bool byteOrderMark, bool throwOnInvalidBytes)
|
||||
: base((!bigEndian) ? 1200 : 1201)
|
||||
{
|
||||
if (throwOnInvalidBytes)
|
||||
{
|
||||
base.SetFallbackInternal(null, new DecoderExceptionFallback());
|
||||
}
|
||||
else
|
||||
{
|
||||
base.SetFallbackInternal(null, new DecoderReplacementFallback("\ufffd"));
|
||||
}
|
||||
this.bigEndian = bigEndian;
|
||||
this.byteOrderMark = byteOrderMark;
|
||||
if (bigEndian)
|
||||
{
|
||||
this.body_name = "unicodeFFFE";
|
||||
this.encoding_name = "Unicode (Big-Endian)";
|
||||
this.header_name = "unicodeFFFE";
|
||||
this.is_browser_save = false;
|
||||
this.web_name = "unicodeFFFE";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.body_name = "utf-16";
|
||||
this.encoding_name = "Unicode";
|
||||
this.header_name = "utf-16";
|
||||
this.is_browser_save = true;
|
||||
this.web_name = "utf-16";
|
||||
}
|
||||
this.windows_code_page = 1200;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of bytes produced by encoding a set of characters from the specified character array.</summary>
|
||||
/// <returns>The number of bytes produced by encoding the specified characters.</returns>
|
||||
/// <param name="chars">The character array containing the set of characters to encode. </param>
|
||||
/// <param name="index">The index of the first character to encode. </param>
|
||||
/// <param name="count">The number of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="chars" />.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="chars" /> contains an invalid sequence of characters. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003865 RID: 14437 RVA: 0x000C2F7C File Offset: 0x000C117C
|
||||
public override int GetByteCount(char[] chars, int index, int count)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (index < 0 || index > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (count < 0 || count > chars.Length - index)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
return count * 2;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of bytes produced by encoding the characters in the specified <see cref="T:System.String" />.</summary>
|
||||
/// <returns>The number of bytes produced by encoding the specified characters.</returns>
|
||||
/// <param name="s">The <see cref="T:System.String" /> containing the set of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="s" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="s" /> contains an invalid sequence of characters. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003866 RID: 14438 RVA: 0x000C2FEC File Offset: 0x000C11EC
|
||||
public override int GetByteCount(string s)
|
||||
{
|
||||
if (s == null)
|
||||
{
|
||||
throw new ArgumentNullException("s");
|
||||
}
|
||||
return s.Length * 2;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of bytes produced by encoding a set of characters starting at the specified character pointer.</summary>
|
||||
/// <returns>The number of bytes produced by encoding the specified characters.</returns>
|
||||
/// <param name="chars">A pointer to the first character to encode. </param>
|
||||
/// <param name="count">The number of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null (Nothing in Visual Basic .NET). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="count" /> is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled and <paramref name="chars" /> contains an invalid sequence of characters. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003867 RID: 14439 RVA: 0x000C3008 File Offset: 0x000C1208
|
||||
[ComVisible(false)]
|
||||
[CLSCompliant(false)]
|
||||
public unsafe override int GetByteCount(char* chars, int count)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count");
|
||||
}
|
||||
return count * 2;
|
||||
}
|
||||
|
||||
/// <summary>Encodes a set of characters from the specified character array into the specified byte array.</summary>
|
||||
/// <returns>The actual number of bytes written into <paramref name="bytes" />.</returns>
|
||||
/// <param name="chars">The character array containing the set of characters to encode. </param>
|
||||
/// <param name="charIndex">The index of the first character to encode. </param>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <param name="bytes">The byte array to contain the resulting sequence of bytes. </param>
|
||||
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null (Nothing).-or- <paramref name="bytes" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charIndex" /> or <paramref name="charCount" /> or <paramref name="byteIndex" /> is less than zero.-or- <paramref name="charIndex" /> and <paramref name="charCount" /> do not denote a valid range in <paramref name="chars" />.-or- <paramref name="byteIndex" /> is not a valid index in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="chars" /> contains an invalid sequence of characters.-or- <paramref name="bytes" /> does not have enough capacity from <paramref name="byteIndex" /> to the end of the array to accommodate the resulting bytes. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003868 RID: 14440 RVA: 0x000C303C File Offset: 0x000C123C
|
||||
public unsafe override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex)
|
||||
{
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (charIndex < 0 || charIndex > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charCount < 0 || charCount > chars.Length - charIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charCount == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int num = bytes.Length - byteIndex;
|
||||
if (bytes.Length == 0)
|
||||
{
|
||||
bytes = new byte[1];
|
||||
}
|
||||
fixed (char* ptr = (ref chars != null && chars.Length != 0 ? ref chars[0] : ref *null))
|
||||
{
|
||||
fixed (byte* ptr2 = (ref bytes != null && bytes.Length != 0 ? ref bytes[0] : ref *null))
|
||||
{
|
||||
return this.GetBytesInternal(ptr + charIndex, charCount, ptr2 + byteIndex, num);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Encodes a set of characters from the specified <see cref="T:System.String" /> into the specified byte array.</summary>
|
||||
/// <returns>The actual number of bytes written into <paramref name="bytes" />.</returns>
|
||||
/// <param name="s">The <see cref="T:System.String" /> containing the set of characters to encode. </param>
|
||||
/// <param name="charIndex">The index of the first character to encode. </param>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <param name="bytes">The byte array to contain the resulting sequence of bytes. </param>
|
||||
/// <param name="byteIndex">The index at which to start writing the resulting sequence of bytes. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="s" /> is null (Nothing).-or- <paramref name="bytes" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charIndex" /> or <paramref name="charCount" /> or <paramref name="byteIndex" /> is less than zero.-or- <paramref name="charIndex" /> and <paramref name="charCount" /> do not denote a valid range in <paramref name="chars" />.-or- <paramref name="byteIndex" /> is not a valid index in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="s" /> contains an invalid sequence of characters.-or- <paramref name="bytes" /> does not have enough capacity from <paramref name="byteIndex" /> to the end of the array to accommodate the resulting bytes. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003869 RID: 14441 RVA: 0x000C3150 File Offset: 0x000C1350
|
||||
public unsafe override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex)
|
||||
{
|
||||
if (s == null)
|
||||
{
|
||||
throw new ArgumentNullException("s");
|
||||
}
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (charIndex < 0 || charIndex > s.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex", Encoding._("ArgRange_StringIndex"));
|
||||
}
|
||||
if (charCount < 0 || charCount > s.Length - charIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount", Encoding._("ArgRange_StringRange"));
|
||||
}
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charCount == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int num = bytes.Length - byteIndex;
|
||||
if (bytes.Length == 0)
|
||||
{
|
||||
bytes = new byte[1];
|
||||
}
|
||||
fixed (char* ptr = s + RuntimeHelpers.OffsetToStringData / 2)
|
||||
{
|
||||
fixed (byte* ptr2 = (ref bytes != null && bytes.Length != 0 ? ref bytes[0] : ref *null))
|
||||
{
|
||||
return this.GetBytesInternal(ptr + charIndex, charCount, ptr2 + byteIndex, num);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Encodes a set of characters starting at the specified character pointer into a sequence of bytes that are stored starting at the specified byte pointer.</summary>
|
||||
/// <returns>The actual number of bytes written at the location indicated by the <paramref name="bytes" /> parameter.</returns>
|
||||
/// <param name="chars">A pointer to the first character to encode. </param>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <param name="bytes">A pointer to the location at which to start writing the resulting sequence of bytes. </param>
|
||||
/// <param name="byteCount">The maximum number of bytes to write. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null (Nothing).-or- <paramref name="bytes" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charCount" /> or <paramref name="byteCount" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="chars" /> contains an invalid sequence of characters.-or- <paramref name="byteCount" /> is less than the resulting number of bytes. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600386A RID: 14442 RVA: 0x000C3258 File Offset: 0x000C1458
|
||||
[CLSCompliant(false)]
|
||||
[ComVisible(false)]
|
||||
public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (charCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount");
|
||||
}
|
||||
if (byteCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount");
|
||||
}
|
||||
return this.GetBytesInternal(chars, charCount, bytes, byteCount);
|
||||
}
|
||||
|
||||
// Token: 0x0600386B RID: 14443 RVA: 0x000C32B8 File Offset: 0x000C14B8
|
||||
private unsafe int GetBytesInternal(char* chars, int charCount, byte* bytes, int byteCount)
|
||||
{
|
||||
int num = charCount * 2;
|
||||
if (byteCount < num)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"));
|
||||
}
|
||||
UnicodeEncoding.CopyChars((byte*)chars, bytes, num, this.bigEndian);
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.</summary>
|
||||
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <param name="index">The index of the first byte to decode. </param>
|
||||
/// <param name="count">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="bytes" />.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="bytes" /> contains an invalid sequence of bytes. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600386C RID: 14444 RVA: 0x000C32F0 File Offset: 0x000C14F0
|
||||
public override int GetCharCount(byte[] bytes, int index, int count)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (index < 0 || index > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (count < 0 || count > bytes.Length - index)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
return count / 2;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the number of characters produced by decoding a sequence of bytes starting at the specified byte pointer.</summary>
|
||||
/// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">A pointer to the first byte to decode. </param>
|
||||
/// <param name="count">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="count" /> is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="bytes" /> contains an invalid sequence of bytes. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600386D RID: 14445 RVA: 0x000C3360 File Offset: 0x000C1560
|
||||
[ComVisible(false)]
|
||||
[CLSCompliant(false)]
|
||||
public unsafe override int GetCharCount(byte* bytes, int count)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count");
|
||||
}
|
||||
return count / 2;
|
||||
}
|
||||
|
||||
/// <summary>Decodes a sequence of bytes from the specified byte array into the specified character array.</summary>
|
||||
/// <returns>The actual number of characters written into <paramref name="chars" />.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <param name="byteIndex">The index of the first byte to decode. </param>
|
||||
/// <param name="byteCount">The number of bytes to decode. </param>
|
||||
/// <param name="chars">The character array to contain the resulting set of characters. </param>
|
||||
/// <param name="charIndex">The index at which to start writing the resulting set of characters. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null (Nothing).-or- <paramref name="chars" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteIndex" /> or <paramref name="byteCount" /> or <paramref name="charIndex" /> is less than zero.-or- <paramref name="byteindex" /> and <paramref name="byteCount" /> do not denote a valid range in <paramref name="bytes" />.-or- <paramref name="charIndex" /> is not a valid index in <paramref name="chars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="bytes" /> contains an invalid sequence of bytes.-or- <paramref name="chars" /> does not have enough capacity from <paramref name="charIndex" /> to the end of the array to accommodate the resulting characters. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600386E RID: 14446 RVA: 0x000C3394 File Offset: 0x000C1594
|
||||
public unsafe override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (byteCount < 0 || byteCount > bytes.Length - byteIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charIndex < 0 || charIndex > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (byteCount == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int num = chars.Length - charIndex;
|
||||
if (chars.Length == 0)
|
||||
{
|
||||
chars = new char[1];
|
||||
}
|
||||
fixed (byte* ptr = (ref bytes != null && bytes.Length != 0 ? ref bytes[0] : ref *null))
|
||||
{
|
||||
fixed (char* ptr2 = (ref chars != null && chars.Length != 0 ? ref chars[0] : ref *null))
|
||||
{
|
||||
return this.GetCharsInternal(ptr + byteIndex, byteCount, ptr2 + charIndex, num);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Decodes a sequence of bytes starting at the specified byte pointer into a set of characters that are stored starting at the specified character pointer.</summary>
|
||||
/// <returns>The actual number of characters written at the location indicated by the <paramref name="chars" /> parameter.</returns>
|
||||
/// <param name="bytes">A pointer to the first byte to decode. </param>
|
||||
/// <param name="byteCount">The number of bytes to decode. </param>
|
||||
/// <param name="chars">A pointer to the location at which to start writing the resulting set of characters. </param>
|
||||
/// <param name="charCount">The maximum number of characters to write. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null (Nothing).-or- <paramref name="chars" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteCount" /> or <paramref name="charCount" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="bytes" /> contains an invalid sequence of bytes.-or- <paramref name="charCount" /> is less than the resulting number of characters. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600386F RID: 14447 RVA: 0x000C34A8 File Offset: 0x000C16A8
|
||||
[ComVisible(false)]
|
||||
[CLSCompliant(false)]
|
||||
public unsafe override int GetChars(byte* bytes, int byteCount, char* chars, int charCount)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (charCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount");
|
||||
}
|
||||
if (byteCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount");
|
||||
}
|
||||
return this.GetCharsInternal(bytes, byteCount, chars, charCount);
|
||||
}
|
||||
|
||||
/// <summary>Decodes a range of bytes from a byte array into a string.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> object containing the results of decoding the specified sequence of bytes.</returns>
|
||||
/// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
|
||||
/// <param name="index">The index of the first byte to decode. </param>
|
||||
/// <param name="count">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="bytes" /> is null (Nothing). </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="bytes" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Error detection is enabled, and <paramref name="bytes" /> contains an invalid sequence of bytes. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003870 RID: 14448 RVA: 0x000C3508 File Offset: 0x000C1708
|
||||
[ComVisible(false)]
|
||||
public unsafe override string GetString(byte[] bytes, int index, int count)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (index < 0 || index > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (count < 0 || count > bytes.Length - index)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (count == 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
int num = count / 2;
|
||||
string text = string.InternalAllocateStr(num);
|
||||
fixed (byte* ptr = (ref bytes != null && bytes.Length != 0 ? ref bytes[0] : ref *null))
|
||||
{
|
||||
fixed (string text2 = text)
|
||||
{
|
||||
fixed (char* ptr2 = text2 + RuntimeHelpers.OffsetToStringData / 2)
|
||||
{
|
||||
this.GetCharsInternal(ptr + index, count, ptr2, num);
|
||||
text2 = null;
|
||||
ptr = null;
|
||||
return text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06003871 RID: 14449 RVA: 0x000C35C8 File Offset: 0x000C17C8
|
||||
private unsafe int GetCharsInternal(byte* bytes, int byteCount, char* chars, int charCount)
|
||||
{
|
||||
int num = byteCount / 2;
|
||||
if (charCount < num)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"));
|
||||
}
|
||||
UnicodeEncoding.CopyChars(bytes, (byte*)chars, byteCount, this.bigEndian);
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>Obtains an encoder that converts a sequence of Unicode characters into a UTF-16 encoded sequence of bytes.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.Encoder" /> object that converts a sequence of Unicode characters into a UTF-16 encoded sequence of bytes.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003872 RID: 14450 RVA: 0x000C3600 File Offset: 0x000C1800
|
||||
[ComVisible(false)]
|
||||
public override Encoder GetEncoder()
|
||||
{
|
||||
return base.GetEncoder();
|
||||
}
|
||||
|
||||
/// <summary>Calculates the maximum number of bytes produced by encoding the specified number of characters.</summary>
|
||||
/// <returns>The maximum number of bytes produced by encoding the specified number of characters.</returns>
|
||||
/// <param name="charCount">The number of characters to encode. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="charCount" /> is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003873 RID: 14451 RVA: 0x000C3608 File Offset: 0x000C1808
|
||||
public override int GetMaxByteCount(int charCount)
|
||||
{
|
||||
if (charCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charCount", Encoding._("ArgRange_NonNegative"));
|
||||
}
|
||||
return charCount * 2;
|
||||
}
|
||||
|
||||
/// <summary>Calculates the maximum number of characters produced by decoding the specified number of bytes.</summary>
|
||||
/// <returns>The maximum number of characters produced by decoding the specified number of bytes.</returns>
|
||||
/// <param name="byteCount">The number of bytes to decode. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="byteCount" /> is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. </exception>
|
||||
/// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for fuller explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003874 RID: 14452 RVA: 0x000C362C File Offset: 0x000C182C
|
||||
public override int GetMaxCharCount(int byteCount)
|
||||
{
|
||||
if (byteCount < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount", Encoding._("ArgRange_NonNegative"));
|
||||
}
|
||||
return byteCount / 2;
|
||||
}
|
||||
|
||||
/// <summary>Obtains a decoder that converts a UTF-16 encoded sequence of bytes into a sequence of Unicode characters.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.Decoder" /> that converts a UTF-16 encoded sequence of bytes into a sequence of Unicode characters.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003875 RID: 14453 RVA: 0x000C3650 File Offset: 0x000C1850
|
||||
public override Decoder GetDecoder()
|
||||
{
|
||||
return new UnicodeEncoding.UnicodeDecoder(this.bigEndian);
|
||||
}
|
||||
|
||||
/// <summary>Returns a Unicode byte order mark encoded in UTF-16 format, if the constructor for this instance requests a byte order mark.</summary>
|
||||
/// <returns>A byte array containing the Unicode byte order mark, if the constructor for this instance requests a byte order mark. Otherwise, this method returns a byte array of length zero.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003876 RID: 14454 RVA: 0x000C3660 File Offset: 0x000C1860
|
||||
public override byte[] GetPreamble()
|
||||
{
|
||||
if (this.byteOrderMark)
|
||||
{
|
||||
byte[] array = new byte[2];
|
||||
if (this.bigEndian)
|
||||
{
|
||||
array[0] = 254;
|
||||
array[1] = byte.MaxValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
array[0] = byte.MaxValue;
|
||||
array[1] = 254;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
/// <summary>Determines whether the specified <see cref="T:System.Object" /> is equal to the current <see cref="T:System.Text.UnicodeEncoding" /> object.</summary>
|
||||
/// <returns>true if <paramref name="value" /> is an instance of <see cref="T:System.Text.UnicodeEncoding" /> and is equal to the current object; otherwise, false.</returns>
|
||||
/// <param name="value">The <see cref="T:System.Object" /> to compare with the current object. </param>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003877 RID: 14455 RVA: 0x000C36B8 File Offset: 0x000C18B8
|
||||
public override bool Equals(object value)
|
||||
{
|
||||
UnicodeEncoding unicodeEncoding = value as UnicodeEncoding;
|
||||
return unicodeEncoding != null && (this.codePage == unicodeEncoding.codePage && this.bigEndian == unicodeEncoding.bigEndian) && this.byteOrderMark == unicodeEncoding.byteOrderMark;
|
||||
}
|
||||
|
||||
/// <summary>Returns the hash code for the current instance.</summary>
|
||||
/// <returns>The hash code for the current <see cref="T:System.Text.UnicodeEncoding" /> object.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06003878 RID: 14456 RVA: 0x000C3708 File Offset: 0x000C1908
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
// Token: 0x06003879 RID: 14457 RVA: 0x000C3710 File Offset: 0x000C1910
|
||||
private unsafe static void CopyChars(byte* src, byte* dest, int count, bool bigEndian)
|
||||
{
|
||||
if (BitConverter.IsLittleEndian != bigEndian)
|
||||
{
|
||||
string.memcpy(dest, src, count & -2);
|
||||
return;
|
||||
}
|
||||
switch (count)
|
||||
{
|
||||
case 0:
|
||||
return;
|
||||
case 1:
|
||||
return;
|
||||
case 2:
|
||||
goto IL_220;
|
||||
case 3:
|
||||
goto IL_220;
|
||||
case 4:
|
||||
goto IL_1F1;
|
||||
case 5:
|
||||
goto IL_1F1;
|
||||
case 6:
|
||||
goto IL_1F1;
|
||||
case 7:
|
||||
goto IL_1F1;
|
||||
case 8:
|
||||
break;
|
||||
case 9:
|
||||
break;
|
||||
case 10:
|
||||
break;
|
||||
case 11:
|
||||
break;
|
||||
case 12:
|
||||
break;
|
||||
case 13:
|
||||
break;
|
||||
case 14:
|
||||
break;
|
||||
case 15:
|
||||
break;
|
||||
default:
|
||||
do
|
||||
{
|
||||
*dest = src[1];
|
||||
dest[1] = *src;
|
||||
dest[2] = src[3];
|
||||
dest[3] = src[2];
|
||||
dest[4] = src[5];
|
||||
dest[5] = src[4];
|
||||
dest[6] = src[7];
|
||||
dest[7] = src[6];
|
||||
dest[8] = src[9];
|
||||
dest[9] = src[8];
|
||||
dest[10] = src[11];
|
||||
dest[11] = src[10];
|
||||
dest[12] = src[13];
|
||||
dest[13] = src[12];
|
||||
dest[14] = src[15];
|
||||
dest[15] = src[14];
|
||||
dest += 16;
|
||||
src += 16;
|
||||
count -= 16;
|
||||
}
|
||||
while ((count & -16) != 0);
|
||||
switch (count)
|
||||
{
|
||||
case 0:
|
||||
return;
|
||||
case 1:
|
||||
return;
|
||||
case 2:
|
||||
goto IL_220;
|
||||
case 3:
|
||||
goto IL_220;
|
||||
case 4:
|
||||
goto IL_1F1;
|
||||
case 5:
|
||||
goto IL_1F1;
|
||||
case 6:
|
||||
goto IL_1F1;
|
||||
case 7:
|
||||
goto IL_1F1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
*dest = src[1];
|
||||
dest[1] = *src;
|
||||
dest[2] = src[3];
|
||||
dest[3] = src[2];
|
||||
dest[4] = src[5];
|
||||
dest[5] = src[4];
|
||||
dest[6] = src[7];
|
||||
dest[7] = src[6];
|
||||
dest += 8;
|
||||
src += 8;
|
||||
if ((count & 4) == 0)
|
||||
{
|
||||
goto IL_217;
|
||||
}
|
||||
IL_1F1:
|
||||
*dest = src[1];
|
||||
dest[1] = *src;
|
||||
dest[2] = src[3];
|
||||
dest[3] = src[2];
|
||||
dest += 4;
|
||||
src += 4;
|
||||
IL_217:
|
||||
if ((count & 2) == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
IL_220:
|
||||
*dest = src[1];
|
||||
dest[1] = *src;
|
||||
}
|
||||
|
||||
// Token: 0x040016D1 RID: 5841
|
||||
internal const int UNICODE_CODE_PAGE = 1200;
|
||||
|
||||
// Token: 0x040016D2 RID: 5842
|
||||
internal const int BIG_UNICODE_CODE_PAGE = 1201;
|
||||
|
||||
/// <summary>Represents the Unicode version 2.0 character size in bytes. This field is a constant.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x040016D3 RID: 5843
|
||||
public const int CharSize = 2;
|
||||
|
||||
// Token: 0x040016D4 RID: 5844
|
||||
private bool bigEndian;
|
||||
|
||||
// Token: 0x040016D5 RID: 5845
|
||||
private bool byteOrderMark;
|
||||
|
||||
// Token: 0x02000605 RID: 1541
|
||||
private sealed class UnicodeDecoder : Decoder
|
||||
{
|
||||
// Token: 0x0600387A RID: 14458 RVA: 0x000C394C File Offset: 0x000C1B4C
|
||||
public UnicodeDecoder(bool bigEndian)
|
||||
{
|
||||
this.bigEndian = bigEndian;
|
||||
this.leftOverByte = -1;
|
||||
}
|
||||
|
||||
// Token: 0x0600387B RID: 14459 RVA: 0x000C3964 File Offset: 0x000C1B64
|
||||
public override int GetCharCount(byte[] bytes, int index, int count)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (index < 0 || index > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (count < 0 || count > bytes.Length - index)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (this.leftOverByte != -1)
|
||||
{
|
||||
return (count + 1) / 2;
|
||||
}
|
||||
return count / 2;
|
||||
}
|
||||
|
||||
// Token: 0x0600387C RID: 14460 RVA: 0x000C39E4 File Offset: 0x000C1BE4
|
||||
public unsafe override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
throw new ArgumentNullException("bytes");
|
||||
}
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
if (byteIndex < 0 || byteIndex > bytes.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (byteCount < 0 || byteCount > bytes.Length - byteIndex)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("byteCount", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (charIndex < 0 || charIndex > chars.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("charIndex", Encoding._("ArgRange_Array"));
|
||||
}
|
||||
if (byteCount == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int num = this.leftOverByte;
|
||||
int num2;
|
||||
if (num != -1)
|
||||
{
|
||||
num2 = (byteCount + 1) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
num2 = byteCount / 2;
|
||||
}
|
||||
if (chars.Length - charIndex < num2)
|
||||
{
|
||||
throw new ArgumentException(Encoding._("Arg_InsufficientSpace"));
|
||||
}
|
||||
if (num != -1)
|
||||
{
|
||||
if (this.bigEndian)
|
||||
{
|
||||
chars[charIndex] = (char)((num << 8) | (int)bytes[byteIndex]);
|
||||
}
|
||||
else
|
||||
{
|
||||
chars[charIndex] = (char)(((int)bytes[byteIndex] << 8) | num);
|
||||
}
|
||||
charIndex++;
|
||||
byteIndex++;
|
||||
byteCount--;
|
||||
}
|
||||
if ((byteCount & -2) != 0)
|
||||
{
|
||||
fixed (byte* ptr = (ref bytes != null && bytes.Length != 0 ? ref bytes[0] : ref *null))
|
||||
{
|
||||
fixed (char* ptr2 = (ref chars != null && chars.Length != 0 ? ref chars[0] : ref *null))
|
||||
{
|
||||
UnicodeEncoding.CopyChars(ptr + byteIndex, (byte*)(ptr2 + charIndex), byteCount, this.bigEndian);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((byteCount & 1) == 0)
|
||||
{
|
||||
this.leftOverByte = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.leftOverByte = (int)bytes[byteCount + byteIndex - 1];
|
||||
}
|
||||
return num2;
|
||||
}
|
||||
|
||||
// Token: 0x040016D6 RID: 5846
|
||||
private bool bigEndian;
|
||||
|
||||
// Token: 0x040016D7 RID: 5847
|
||||
private int leftOverByte;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user