scripts
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Google.Protobuf.Reflection
|
||||
{
|
||||
// Token: 0x02000065 RID: 101
|
||||
public sealed class OneofAccessor
|
||||
{
|
||||
// Token: 0x060005DE RID: 1502 RVA: 0x00014ACC File Offset: 0x00012CCC
|
||||
internal OneofAccessor(PropertyInfo caseProperty, MethodInfo clearMethod, OneofDescriptor descriptor)
|
||||
{
|
||||
if (!caseProperty.CanRead)
|
||||
{
|
||||
throw new ArgumentException("Cannot read from property");
|
||||
}
|
||||
this.descriptor = descriptor;
|
||||
this.caseDelegate = ReflectionUtil.CreateFuncIMessageT<int>(caseProperty.GetGetMethod());
|
||||
this.descriptor = descriptor;
|
||||
this.clearDelegate = ReflectionUtil.CreateActionIMessage(clearMethod);
|
||||
}
|
||||
|
||||
// Token: 0x170001A8 RID: 424
|
||||
// (get) Token: 0x060005DF RID: 1503 RVA: 0x00014B1D File Offset: 0x00012D1D
|
||||
public OneofDescriptor Descriptor
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.descriptor;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060005E0 RID: 1504 RVA: 0x00014B25 File Offset: 0x00012D25
|
||||
public void Clear(IMessage message)
|
||||
{
|
||||
this.clearDelegate(message);
|
||||
}
|
||||
|
||||
// Token: 0x060005E1 RID: 1505 RVA: 0x00014B34 File Offset: 0x00012D34
|
||||
public FieldDescriptor GetCaseFieldDescriptor(IMessage message)
|
||||
{
|
||||
int num = this.caseDelegate(message);
|
||||
if (num > 0)
|
||||
{
|
||||
return this.descriptor.ContainingType.FindFieldByNumber(num);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Token: 0x04000254 RID: 596
|
||||
private readonly Func<IMessage, int> caseDelegate;
|
||||
|
||||
// Token: 0x04000255 RID: 597
|
||||
private readonly Action<IMessage> clearDelegate;
|
||||
|
||||
// Token: 0x04000256 RID: 598
|
||||
private OneofDescriptor descriptor;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user