using System;
using System.Collections;
namespace System.Text.RegularExpressions
{
/// Represents the set of successful matches found by iteratively applying a regular expression pattern to the input string.
// Token: 0x020002B0 RID: 688
[Serializable]
public class MatchCollection : ICollection, IEnumerable
{
// Token: 0x06001919 RID: 6425 RVA: 0x00055DE4 File Offset: 0x00053FE4
internal MatchCollection(Match start)
{
this.current = start;
this.list = new ArrayList();
}
/// Gets the number of matches.
/// The number of matches.
///
///
///
// Token: 0x170007E1 RID: 2017
// (get) Token: 0x0600191A RID: 6426 RVA: 0x00055E00 File Offset: 0x00054000
public int Count
{
get
{
return this.FullList.Count;
}
}
/// Gets a value that indicates whether the collection is read only.
/// This value of this property is always true.
// Token: 0x170007E2 RID: 2018
// (get) Token: 0x0600191B RID: 6427 RVA: 0x00055E10 File Offset: 0x00054010
public bool IsReadOnly
{
get
{
return true;
}
}
/// Gets a value indicating whether access to the collection is synchronized (thread-safe).
/// The value of this property is always false.
// Token: 0x170007E3 RID: 2019
// (get) Token: 0x0600191C RID: 6428 RVA: 0x00055E14 File Offset: 0x00054014
public bool IsSynchronized
{
get
{
return false;
}
}
/// Gets an individual member of the collection.
/// The captured substring at position in the collection.
/// Index into the Match collection.
///
/// is less than 0 or greater than or equal to .
// Token: 0x170007E4 RID: 2020
public virtual Match this[int i]
{
get
{
if (i < 0 || !this.TryToGet(i))
{
throw new ArgumentOutOfRangeException("i");
}
return (i >= this.list.Count) ? this.current : ((Match)this.list[i]);
}
}
/// Gets an object that can be used to synchronize access to the collection.
/// An object that can be used to synchronize access to the collection. This property always returns the object itself.
// Token: 0x170007E5 RID: 2021
// (get) Token: 0x0600191E RID: 6430 RVA: 0x00055E70 File Offset: 0x00054070
public object SyncRoot
{
get
{
return this.list;
}
}
/// Copies all the elements of the collection to the given array starting at the given index.
/// The array the collection is to be copied into.
/// The position in the array where copying is to begin.
///
/// is a multi-dimensional array.
///
/// is outside the bounds of .-or- plus is outside the bounds of .
// Token: 0x0600191F RID: 6431 RVA: 0x00055E78 File Offset: 0x00054078
public void CopyTo(Array array, int index)
{
this.FullList.CopyTo(array, index);
}
/// Provides an enumerator in the same order as .
/// An object that contains all Match objects within the MatchCollection.
// Token: 0x06001920 RID: 6432 RVA: 0x00055E88 File Offset: 0x00054088
public IEnumerator GetEnumerator()
{
IEnumerator enumerator2;
if (this.current.Success)
{
IEnumerator enumerator = new MatchCollection.Enumerator(this);
enumerator2 = enumerator;
}
else
{
enumerator2 = this.list.GetEnumerator();
}
return enumerator2;
}
// Token: 0x06001921 RID: 6433 RVA: 0x00055EC0 File Offset: 0x000540C0
private bool TryToGet(int i)
{
while (i > this.list.Count && this.current.Success)
{
this.list.Add(this.current);
this.current = this.current.NextMatch();
}
return i < this.list.Count || this.current.Success;
}
// Token: 0x170007E6 RID: 2022
// (get) Token: 0x06001922 RID: 6434 RVA: 0x00055F38 File Offset: 0x00054138
private ICollection FullList
{
get
{
if (this.TryToGet(2147483647))
{
throw new SystemException("too many matches");
}
return this.list;
}
}
// Token: 0x040013D0 RID: 5072
private Match current;
// Token: 0x040013D1 RID: 5073
private ArrayList list;
// Token: 0x020002B1 RID: 689
private class Enumerator : IEnumerator
{
// Token: 0x06001923 RID: 6435 RVA: 0x00055F5C File Offset: 0x0005415C
internal Enumerator(MatchCollection coll)
{
this.coll = coll;
this.index = -1;
}
// Token: 0x06001924 RID: 6436 RVA: 0x00055F74 File Offset: 0x00054174
void IEnumerator.Reset()
{
this.index = -1;
}
// Token: 0x170007E7 RID: 2023
// (get) Token: 0x06001925 RID: 6437 RVA: 0x00055F80 File Offset: 0x00054180
object IEnumerator.Current
{
get
{
if (this.index < 0)
{
throw new InvalidOperationException("'Current' called before 'MoveNext()'");
}
if (this.index > this.coll.list.Count)
{
throw new SystemException("MatchCollection in invalid state");
}
if (this.index == this.coll.list.Count && !this.coll.current.Success)
{
throw new InvalidOperationException("'Current' called after 'MoveNext()' returned false");
}
return (this.index >= this.coll.list.Count) ? this.coll.current : this.coll.list[this.index];
}
}
// Token: 0x06001926 RID: 6438 RVA: 0x00056048 File Offset: 0x00054248
bool IEnumerator.MoveNext()
{
if (this.index > this.coll.list.Count)
{
throw new SystemException("MatchCollection in invalid state");
}
return (this.index != this.coll.list.Count || this.coll.current.Success) && this.coll.TryToGet(++this.index);
}
// Token: 0x040013D2 RID: 5074
private int index;
// Token: 0x040013D3 RID: 5075
private MatchCollection coll;
}
}
}