using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Reflection; namespace Google.Protobuf.Reflection { // Token: 0x02000066 RID: 102 public sealed class OneofDescriptor : DescriptorBase { // Token: 0x060005E2 RID: 1506 RVA: 0x00014B65 File Offset: 0x00012D65 internal OneofDescriptor(OneofDescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int index, string clrName) : base(file, file.ComputeFullName(parent, proto.Name), index) { this.proto = proto; this.containingType = parent; file.DescriptorPool.AddSymbol(this); this.accessor = this.CreateAccessor(clrName); } // Token: 0x170001A9 RID: 425 // (get) Token: 0x060005E3 RID: 1507 RVA: 0x00014BA5 File Offset: 0x00012DA5 public override string Name { get { return this.proto.Name; } } // Token: 0x170001AA RID: 426 // (get) Token: 0x060005E4 RID: 1508 RVA: 0x00014BB2 File Offset: 0x00012DB2 public MessageDescriptor ContainingType { get { return this.containingType; } } // Token: 0x170001AB RID: 427 // (get) Token: 0x060005E5 RID: 1509 RVA: 0x00014BBA File Offset: 0x00012DBA public IList Fields { get { return this.fields; } } // Token: 0x170001AC RID: 428 // (get) Token: 0x060005E6 RID: 1510 RVA: 0x00014BC2 File Offset: 0x00012DC2 public OneofAccessor Accessor { get { return this.accessor; } } // Token: 0x060005E7 RID: 1511 RVA: 0x00014BCC File Offset: 0x00012DCC internal void CrossLink() { List list = new List(); foreach (FieldDescriptor fieldDescriptor in this.ContainingType.Fields.InDeclarationOrder()) { if (fieldDescriptor.ContainingOneof == this) { list.Add(fieldDescriptor); } } this.fields = new ReadOnlyCollection(list); } // Token: 0x060005E8 RID: 1512 RVA: 0x00014C40 File Offset: 0x00012E40 private OneofAccessor CreateAccessor(string clrName) { PropertyInfo property = this.containingType.ClrType.GetProperty(clrName + "Case"); if (property == null) { throw new DescriptorValidationException(this, string.Format("Property {0}Case not found in {1}", clrName, this.containingType.ClrType)); } MethodInfo method = this.containingType.ClrType.GetMethod("Clear" + clrName); if (method == null) { throw new DescriptorValidationException(this, string.Format("Method Clear{0} not found in {1}", clrName, this.containingType.ClrType)); } return new OneofAccessor(property, method, this); } // Token: 0x04000257 RID: 599 private readonly OneofDescriptorProto proto; // Token: 0x04000258 RID: 600 private MessageDescriptor containingType; // Token: 0x04000259 RID: 601 private IList fields; // Token: 0x0400025A RID: 602 private readonly OneofAccessor accessor; } }