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

109 lines
3.5 KiB
C#

using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace System.Globalization
{
/// <summary>Enumerates the text elements of a string. </summary>
// Token: 0x02000199 RID: 409
[ComVisible(true)]
[Serializable]
public class TextElementEnumerator : IEnumerator
{
// Token: 0x060014D0 RID: 5328 RVA: 0x0004FF5C File Offset: 0x0004E15C
internal TextElementEnumerator(string str, int startpos)
{
this.index = -1;
this.startpos = startpos;
this.str = str.Substring(startpos);
this.element = null;
}
/// <summary>Gets the current text element in the string.</summary>
/// <returns>An object containing the current text element in the string.</returns>
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first text element of the string or after the last text element. </exception>
// Token: 0x170003AF RID: 943
// (get) Token: 0x060014D1 RID: 5329 RVA: 0x0004FF94 File Offset: 0x0004E194
public object Current
{
get
{
if (this.element == null)
{
throw new InvalidOperationException();
}
return this.element;
}
}
/// <summary>Gets the index of the text element that the enumerator is currently positioned over.</summary>
/// <returns>The index of the text element that the enumerator is currently positioned over.</returns>
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first text element of the string or after the last text element. </exception>
// Token: 0x170003B0 RID: 944
// (get) Token: 0x060014D2 RID: 5330 RVA: 0x0004FFB0 File Offset: 0x0004E1B0
public int ElementIndex
{
get
{
if (this.element == null)
{
throw new InvalidOperationException();
}
return this.elementindex + this.startpos;
}
}
/// <summary>Gets the current text element in the string.</summary>
/// <returns>A new string containing the current text element in the string being read.</returns>
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first text element of the string or after the last text element. </exception>
// Token: 0x060014D3 RID: 5331 RVA: 0x0004FFD0 File Offset: 0x0004E1D0
public string GetTextElement()
{
if (this.element == null)
{
throw new InvalidOperationException();
}
return this.element;
}
/// <summary>Advances the enumerator to the next text element of the string.</summary>
/// <returns>true if the enumerator was successfully advanced to the next text element; false if the enumerator has passed the end of the string.</returns>
// Token: 0x060014D4 RID: 5332 RVA: 0x0004FFEC File Offset: 0x0004E1EC
public bool MoveNext()
{
this.elementindex = this.index + 1;
if (this.elementindex < this.str.Length)
{
this.element = StringInfo.GetNextTextElement(this.str, this.elementindex);
this.index += this.element.Length;
return true;
}
this.element = null;
return false;
}
/// <summary>Sets the enumerator to its initial position, which is before the first text element in the string.</summary>
// Token: 0x060014D5 RID: 5333 RVA: 0x00050058 File Offset: 0x0004E258
public void Reset()
{
this.element = null;
this.index = -1;
}
// Token: 0x040005E1 RID: 1505
private int index;
// Token: 0x040005E2 RID: 1506
private int elementindex;
// Token: 0x040005E3 RID: 1507
private int startpos;
// Token: 0x040005E4 RID: 1508
private string str;
// Token: 0x040005E5 RID: 1509
private string element;
}
}