using System;
using System.Collections;
using System.Collections.Generic;

namespace Zodiacon.DebugHelp
{
	// Token: 0x02000009 RID: 9
	public sealed class StructDescriptor : IReadOnlyList<StructMember>, IReadOnlyCollection<StructMember>, IEnumerable<StructMember>, IEnumerable
	{
		// Token: 0x06000019 RID: 25 RVA: 0x000021BA File Offset: 0x000003BA
		internal StructDescriptor(int capacity = 8)
		{
			this._membersByName = new Dictionary<string, StructMember>(capacity, StringComparer.InvariantCultureIgnoreCase);
			this._members = new List<StructMember>(capacity);
		}

		// Token: 0x0600001A RID: 26 RVA: 0x000021E0 File Offset: 0x000003E0
		public int GetOffsetOf(string memberName)
		{
			StructMember structMember;
			if (!this._membersByName.TryGetValue(memberName, out structMember))
			{
				return -1;
			}
			return structMember.Offset;
		}

		// Token: 0x0600001B RID: 27 RVA: 0x00002208 File Offset: 0x00000408
		public StructMember GetMember(string memberName)
		{
			StructMember result;
			if (!this._membersByName.TryGetValue(memberName, out result))
			{
				return null;
			}
			return result;
		}

		// Token: 0x1700000B RID: 11
		// (get) Token: 0x0600001C RID: 28 RVA: 0x00002228 File Offset: 0x00000428
		// (set) Token: 0x0600001D RID: 29 RVA: 0x00002230 File Offset: 0x00000430
		public int Length { get; internal set; }

		// Token: 0x1700000C RID: 12
		// (get) Token: 0x0600001E RID: 30 RVA: 0x00002239 File Offset: 0x00000439
		public int Count
		{
			get
			{
				return this._members.Count;
			}
		}

		// Token: 0x1700000D RID: 13
		public StructMember this[int index]
		{
			get
			{
				return this._members[index];
			}
		}

		// Token: 0x06000020 RID: 32 RVA: 0x00002254 File Offset: 0x00000454
		public void AddMember(StructMember member)
		{
			member.Parent = this;
			this._membersByName.Add(member.Symbol.Name, member);
			this._members.Add(member);
		}

		// Token: 0x06000021 RID: 33 RVA: 0x00002280 File Offset: 0x00000480
		public IEnumerator<StructMember> GetEnumerator()
		{
			return this._members.GetEnumerator();
		}

		// Token: 0x06000022 RID: 34 RVA: 0x00002292 File Offset: 0x00000492
		IEnumerator IEnumerable.GetEnumerator()
		{
			return this.GetEnumerator();
		}

		// Token: 0x0400000B RID: 11
		private readonly Dictionary<string, StructMember> _membersByName;

		// Token: 0x0400000C RID: 12
		private readonly List<StructMember> _members;
	}
}
