Files
Dec2017-Script-Dump/mscorlib/System/Text/EncoderReplacementFallback.cs
T
2026-06-04 11:42:34 +02:00

94 lines
4.6 KiB
C#

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;
}
}