100 lines
2.7 KiB
C#
100 lines
2.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Google.Protobuf.Reflection
|
|
{
|
|
// Token: 0x02000059 RID: 89
|
|
public sealed class EnumDescriptor : DescriptorBase
|
|
{
|
|
// Token: 0x06000575 RID: 1397 RVA: 0x000139E4 File Offset: 0x00011BE4
|
|
internal EnumDescriptor(EnumDescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int index, Type clrType)
|
|
: base(file, file.ComputeFullName(parent, proto.Name), index)
|
|
{
|
|
EnumDescriptor <>4__this = this;
|
|
this.proto = proto;
|
|
this.clrType = clrType;
|
|
this.containingType = parent;
|
|
if (proto.Value.Count == 0)
|
|
{
|
|
throw new DescriptorValidationException(this, "Enums must contain at least one value.");
|
|
}
|
|
this.values = DescriptorUtil.ConvertAndMakeReadOnly<EnumValueDescriptorProto, EnumValueDescriptor>(proto.Value, (EnumValueDescriptorProto value, int i) => new EnumValueDescriptor(value, file, <>4__this, i));
|
|
base.File.DescriptorPool.AddSymbol(this);
|
|
}
|
|
|
|
// Token: 0x17000168 RID: 360
|
|
// (get) Token: 0x06000576 RID: 1398 RVA: 0x00013A82 File Offset: 0x00011C82
|
|
internal EnumDescriptorProto Proto
|
|
{
|
|
get
|
|
{
|
|
return this.proto;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000169 RID: 361
|
|
// (get) Token: 0x06000577 RID: 1399 RVA: 0x00013A8A File Offset: 0x00011C8A
|
|
public override string Name
|
|
{
|
|
get
|
|
{
|
|
return this.proto.Name;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700016A RID: 362
|
|
// (get) Token: 0x06000578 RID: 1400 RVA: 0x00013A97 File Offset: 0x00011C97
|
|
public Type ClrType
|
|
{
|
|
get
|
|
{
|
|
return this.clrType;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700016B RID: 363
|
|
// (get) Token: 0x06000579 RID: 1401 RVA: 0x00013A9F File Offset: 0x00011C9F
|
|
public MessageDescriptor ContainingType
|
|
{
|
|
get
|
|
{
|
|
return this.containingType;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700016C RID: 364
|
|
// (get) Token: 0x0600057A RID: 1402 RVA: 0x00013AA7 File Offset: 0x00011CA7
|
|
public IList<EnumValueDescriptor> Values
|
|
{
|
|
get
|
|
{
|
|
return this.values;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600057B RID: 1403 RVA: 0x00013AAF File Offset: 0x00011CAF
|
|
public EnumValueDescriptor FindValueByNumber(int number)
|
|
{
|
|
return base.File.DescriptorPool.FindEnumValueByNumber(this, number);
|
|
}
|
|
|
|
// Token: 0x0600057C RID: 1404 RVA: 0x00013AC3 File Offset: 0x00011CC3
|
|
public EnumValueDescriptor FindValueByName(string name)
|
|
{
|
|
return base.File.DescriptorPool.FindSymbol<EnumValueDescriptor>(base.FullName + "." + name);
|
|
}
|
|
|
|
// Token: 0x04000210 RID: 528
|
|
private readonly EnumDescriptorProto proto;
|
|
|
|
// Token: 0x04000211 RID: 529
|
|
private readonly MessageDescriptor containingType;
|
|
|
|
// Token: 0x04000212 RID: 530
|
|
private readonly IList<EnumValueDescriptor> values;
|
|
|
|
// Token: 0x04000213 RID: 531
|
|
private readonly Type clrType;
|
|
}
|
|
}
|