138 lines
4.5 KiB
C#
138 lines
4.5 KiB
C#
using System;
|
|
using System.Collections;
|
|
|
|
namespace System.Text.RegularExpressions
|
|
{
|
|
/// <summary>Represents a collection of captured groups in a single match. </summary>
|
|
// Token: 0x020002AE RID: 686
|
|
[Serializable]
|
|
public class GroupCollection : ICollection, IEnumerable
|
|
{
|
|
// Token: 0x06001905 RID: 6405 RVA: 0x00055B24 File Offset: 0x00053D24
|
|
internal GroupCollection(int n, int gap)
|
|
{
|
|
this.list = new Group[n];
|
|
this.gap = gap;
|
|
}
|
|
|
|
/// <summary>Returns the number of groups in the collection.</summary>
|
|
/// <returns>The number of groups in the collection.</returns>
|
|
// Token: 0x170007D8 RID: 2008
|
|
// (get) Token: 0x06001906 RID: 6406 RVA: 0x00055B40 File Offset: 0x00053D40
|
|
public int Count
|
|
{
|
|
get
|
|
{
|
|
return this.list.Length;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets a value indicating whether the collection is read-only.</summary>
|
|
/// <returns>true if GroupCollection is read-only; otherwise false.</returns>
|
|
// Token: 0x170007D9 RID: 2009
|
|
// (get) Token: 0x06001907 RID: 6407 RVA: 0x00055B4C File Offset: 0x00053D4C
|
|
public bool IsReadOnly
|
|
{
|
|
get
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets a value indicating whether access to the GroupCollection is synchronized (thread-safe).</summary>
|
|
/// <returns>true if access is synchronized; otherwise false.</returns>
|
|
// Token: 0x170007DA RID: 2010
|
|
// (get) Token: 0x06001908 RID: 6408 RVA: 0x00055B50 File Offset: 0x00053D50
|
|
public bool IsSynchronized
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>Enables access to a member of the collection by integer index.</summary>
|
|
/// <returns>The member of the collection specified by <paramref name="groupnum" />.</returns>
|
|
/// <param name="groupnum">The zero-based index of the collection member to be retrieved. </param>
|
|
// Token: 0x170007DB RID: 2011
|
|
public Group this[int i]
|
|
{
|
|
get
|
|
{
|
|
if (i >= this.gap)
|
|
{
|
|
Match match = (Match)this.list[0];
|
|
i = ((match != Match.Empty) ? match.Regex.GetGroupIndex(i) : (-1));
|
|
}
|
|
return (i >= 0) ? this.list[i] : Group.Fail;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600190A RID: 6410 RVA: 0x00055BB4 File Offset: 0x00053DB4
|
|
internal void SetValue(Group g, int i)
|
|
{
|
|
this.list[i] = g;
|
|
}
|
|
|
|
/// <summary>Enables access to a member of the collection by string index.</summary>
|
|
/// <returns>The member of the collection specified by <paramref name="groupname" />.</returns>
|
|
/// <param name="groupname">The name of a capturing group. </param>
|
|
// Token: 0x170007DC RID: 2012
|
|
public Group this[string groupName]
|
|
{
|
|
get
|
|
{
|
|
Match match = (Match)this.list[0];
|
|
if (match != Match.Empty)
|
|
{
|
|
int num = match.Regex.GroupNumberFromName(groupName);
|
|
if (num != -1)
|
|
{
|
|
return this[num];
|
|
}
|
|
}
|
|
return Group.Fail;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets an object that can be used to synchronize access to the GroupCollection.</summary>
|
|
/// <returns>A copy of the <see cref="T:System.Text.RegularExpressions.Match" /> object to synchronize.</returns>
|
|
// Token: 0x170007DD RID: 2013
|
|
// (get) Token: 0x0600190C RID: 6412 RVA: 0x00055C08 File Offset: 0x00053E08
|
|
public object SyncRoot
|
|
{
|
|
get
|
|
{
|
|
return this.list;
|
|
}
|
|
}
|
|
|
|
/// <summary>Copies all the elements of the collection to the given array beginning at the given index.</summary>
|
|
/// <param name="array">The array the collection is to be copied into. </param>
|
|
/// <param name="arrayIndex">The position in the destination array where the copying is to begin. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="array" /> is null.</exception>
|
|
/// <exception cref="T:System.IndexOutOfRangeException">
|
|
/// <paramref name="arrayIndex" /> is outside the bounds of <paramref name="array" />.-or-<paramref name="arrayIndex" /> plus <see cref="P:System.Text.RegularExpressions.GroupCollection.Count" /> is outside the bounds of <paramref name="array" />.</exception>
|
|
// Token: 0x0600190D RID: 6413 RVA: 0x00055C10 File Offset: 0x00053E10
|
|
public void CopyTo(Array array, int index)
|
|
{
|
|
this.list.CopyTo(array, index);
|
|
}
|
|
|
|
/// <summary>Returns an enumerator that can iterate through the collection.</summary>
|
|
/// <returns>An object that contains all <see cref="T:System.Text.RegularExpressions.Group" /> objects in the <see cref="T:System.Text.RegularExpressions.GroupCollection" />.</returns>
|
|
// Token: 0x0600190E RID: 6414 RVA: 0x00055C20 File Offset: 0x00053E20
|
|
public IEnumerator GetEnumerator()
|
|
{
|
|
return this.list.GetEnumerator();
|
|
}
|
|
|
|
// Token: 0x040013C9 RID: 5065
|
|
private Group[] list;
|
|
|
|
// Token: 0x040013CA RID: 5066
|
|
private int gap;
|
|
}
|
|
}
|