Files
2026-06-04 11:42:34 +02:00

94 lines
4.9 KiB
C#

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