548 lines
13 KiB
C#
548 lines
13 KiB
C#
using System;
|
|
using System.Diagnostics;
|
|
using Google.Protobuf.Reflection;
|
|
|
|
namespace Google.Protobuf.WellKnownTypes
|
|
{
|
|
// Token: 0x0200002A RID: 42
|
|
public sealed class Value : IMessage<Value>, IMessage, IEquatable<Value>, IDeepCloneable<Value>
|
|
{
|
|
// Token: 0x17000062 RID: 98
|
|
// (get) Token: 0x06000221 RID: 545 RVA: 0x00009CD2 File Offset: 0x00007ED2
|
|
[DebuggerNonUserCode]
|
|
public static MessageParser<Value> Parser
|
|
{
|
|
get
|
|
{
|
|
return Value._parser;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000063 RID: 99
|
|
// (get) Token: 0x06000222 RID: 546 RVA: 0x00009CD9 File Offset: 0x00007ED9
|
|
[DebuggerNonUserCode]
|
|
public static MessageDescriptor Descriptor
|
|
{
|
|
get
|
|
{
|
|
return StructReflection.Descriptor.MessageTypes[1];
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000064 RID: 100
|
|
// (get) Token: 0x06000223 RID: 547 RVA: 0x00009CEB File Offset: 0x00007EEB
|
|
[DebuggerNonUserCode]
|
|
MessageDescriptor IMessage.Descriptor
|
|
{
|
|
get
|
|
{
|
|
return Value.Descriptor;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000224 RID: 548 RVA: 0x00007601 File Offset: 0x00005801
|
|
[DebuggerNonUserCode]
|
|
public Value()
|
|
{
|
|
}
|
|
|
|
// Token: 0x06000225 RID: 549 RVA: 0x00009CF4 File Offset: 0x00007EF4
|
|
[DebuggerNonUserCode]
|
|
public Value(Value other)
|
|
: this()
|
|
{
|
|
switch (other.KindCase)
|
|
{
|
|
case Value.KindOneofCase.NullValue:
|
|
this.NullValue = other.NullValue;
|
|
return;
|
|
case Value.KindOneofCase.NumberValue:
|
|
this.NumberValue = other.NumberValue;
|
|
return;
|
|
case Value.KindOneofCase.StringValue:
|
|
this.StringValue = other.StringValue;
|
|
return;
|
|
case Value.KindOneofCase.BoolValue:
|
|
this.BoolValue = other.BoolValue;
|
|
return;
|
|
case Value.KindOneofCase.StructValue:
|
|
this.StructValue = other.StructValue.Clone();
|
|
return;
|
|
case Value.KindOneofCase.ListValue:
|
|
this.ListValue = other.ListValue.Clone();
|
|
return;
|
|
default:
|
|
return;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000226 RID: 550 RVA: 0x00009D86 File Offset: 0x00007F86
|
|
[DebuggerNonUserCode]
|
|
public Value Clone()
|
|
{
|
|
return new Value(this);
|
|
}
|
|
|
|
// Token: 0x17000065 RID: 101
|
|
// (get) Token: 0x06000227 RID: 551 RVA: 0x00009D8E File Offset: 0x00007F8E
|
|
// (set) Token: 0x06000228 RID: 552 RVA: 0x00009DA6 File Offset: 0x00007FA6
|
|
[DebuggerNonUserCode]
|
|
public NullValue NullValue
|
|
{
|
|
get
|
|
{
|
|
if (this.kindCase_ != Value.KindOneofCase.NullValue)
|
|
{
|
|
return NullValue.NullValue;
|
|
}
|
|
return (NullValue)this.kind_;
|
|
}
|
|
set
|
|
{
|
|
this.kind_ = value;
|
|
this.kindCase_ = Value.KindOneofCase.NullValue;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000066 RID: 102
|
|
// (get) Token: 0x06000229 RID: 553 RVA: 0x00009DBB File Offset: 0x00007FBB
|
|
// (set) Token: 0x0600022A RID: 554 RVA: 0x00009DDB File Offset: 0x00007FDB
|
|
[DebuggerNonUserCode]
|
|
public double NumberValue
|
|
{
|
|
get
|
|
{
|
|
if (this.kindCase_ != Value.KindOneofCase.NumberValue)
|
|
{
|
|
return 0.0;
|
|
}
|
|
return (double)this.kind_;
|
|
}
|
|
set
|
|
{
|
|
this.kind_ = value;
|
|
this.kindCase_ = Value.KindOneofCase.NumberValue;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000067 RID: 103
|
|
// (get) Token: 0x0600022B RID: 555 RVA: 0x00009DF0 File Offset: 0x00007FF0
|
|
// (set) Token: 0x0600022C RID: 556 RVA: 0x00009E0C File Offset: 0x0000800C
|
|
[DebuggerNonUserCode]
|
|
public string StringValue
|
|
{
|
|
get
|
|
{
|
|
if (this.kindCase_ != Value.KindOneofCase.StringValue)
|
|
{
|
|
return "";
|
|
}
|
|
return (string)this.kind_;
|
|
}
|
|
set
|
|
{
|
|
this.kind_ = ProtoPreconditions.CheckNotNull<string>(value, "value");
|
|
this.kindCase_ = Value.KindOneofCase.StringValue;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000068 RID: 104
|
|
// (get) Token: 0x0600022D RID: 557 RVA: 0x00009E26 File Offset: 0x00008026
|
|
// (set) Token: 0x0600022E RID: 558 RVA: 0x00009E3E File Offset: 0x0000803E
|
|
[DebuggerNonUserCode]
|
|
public bool BoolValue
|
|
{
|
|
get
|
|
{
|
|
return this.kindCase_ == Value.KindOneofCase.BoolValue && (bool)this.kind_;
|
|
}
|
|
set
|
|
{
|
|
this.kind_ = value;
|
|
this.kindCase_ = Value.KindOneofCase.BoolValue;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000069 RID: 105
|
|
// (get) Token: 0x0600022F RID: 559 RVA: 0x00009E53 File Offset: 0x00008053
|
|
// (set) Token: 0x06000230 RID: 560 RVA: 0x00009E6B File Offset: 0x0000806B
|
|
[DebuggerNonUserCode]
|
|
public Struct StructValue
|
|
{
|
|
get
|
|
{
|
|
if (this.kindCase_ != Value.KindOneofCase.StructValue)
|
|
{
|
|
return null;
|
|
}
|
|
return (Struct)this.kind_;
|
|
}
|
|
set
|
|
{
|
|
this.kind_ = value;
|
|
this.kindCase_ = ((value == null) ? Value.KindOneofCase.None : Value.KindOneofCase.StructValue);
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700006A RID: 106
|
|
// (get) Token: 0x06000231 RID: 561 RVA: 0x00009E81 File Offset: 0x00008081
|
|
// (set) Token: 0x06000232 RID: 562 RVA: 0x00009E99 File Offset: 0x00008099
|
|
[DebuggerNonUserCode]
|
|
public ListValue ListValue
|
|
{
|
|
get
|
|
{
|
|
if (this.kindCase_ != Value.KindOneofCase.ListValue)
|
|
{
|
|
return null;
|
|
}
|
|
return (ListValue)this.kind_;
|
|
}
|
|
set
|
|
{
|
|
this.kind_ = value;
|
|
this.kindCase_ = ((value == null) ? Value.KindOneofCase.None : Value.KindOneofCase.ListValue);
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700006B RID: 107
|
|
// (get) Token: 0x06000233 RID: 563 RVA: 0x00009EAF File Offset: 0x000080AF
|
|
[DebuggerNonUserCode]
|
|
public Value.KindOneofCase KindCase
|
|
{
|
|
get
|
|
{
|
|
return this.kindCase_;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000234 RID: 564 RVA: 0x00009EB7 File Offset: 0x000080B7
|
|
[DebuggerNonUserCode]
|
|
public void ClearKind()
|
|
{
|
|
this.kindCase_ = Value.KindOneofCase.None;
|
|
this.kind_ = null;
|
|
}
|
|
|
|
// Token: 0x06000235 RID: 565 RVA: 0x00009EC7 File Offset: 0x000080C7
|
|
[DebuggerNonUserCode]
|
|
public override bool Equals(object other)
|
|
{
|
|
return this.Equals(other as Value);
|
|
}
|
|
|
|
// Token: 0x06000236 RID: 566 RVA: 0x00009ED8 File Offset: 0x000080D8
|
|
[DebuggerNonUserCode]
|
|
public bool Equals(Value other)
|
|
{
|
|
return other != null && (other == this || (this.NullValue == other.NullValue && this.NumberValue == other.NumberValue && !(this.StringValue != other.StringValue) && this.BoolValue == other.BoolValue && object.Equals(this.StructValue, other.StructValue) && object.Equals(this.ListValue, other.ListValue) && this.KindCase == other.KindCase));
|
|
}
|
|
|
|
// Token: 0x06000237 RID: 567 RVA: 0x00009F70 File Offset: 0x00008170
|
|
[DebuggerNonUserCode]
|
|
public override int GetHashCode()
|
|
{
|
|
int num = 1;
|
|
if (this.kindCase_ == Value.KindOneofCase.NullValue)
|
|
{
|
|
num ^= this.NullValue.GetHashCode();
|
|
}
|
|
if (this.kindCase_ == Value.KindOneofCase.NumberValue)
|
|
{
|
|
num ^= this.NumberValue.GetHashCode();
|
|
}
|
|
if (this.kindCase_ == Value.KindOneofCase.StringValue)
|
|
{
|
|
num ^= this.StringValue.GetHashCode();
|
|
}
|
|
if (this.kindCase_ == Value.KindOneofCase.BoolValue)
|
|
{
|
|
num ^= this.BoolValue.GetHashCode();
|
|
}
|
|
if (this.kindCase_ == Value.KindOneofCase.StructValue)
|
|
{
|
|
num ^= this.StructValue.GetHashCode();
|
|
}
|
|
if (this.kindCase_ == Value.KindOneofCase.ListValue)
|
|
{
|
|
num ^= this.ListValue.GetHashCode();
|
|
}
|
|
return num ^ (int)this.kindCase_;
|
|
}
|
|
|
|
// Token: 0x06000238 RID: 568 RVA: 0x00007C02 File Offset: 0x00005E02
|
|
[DebuggerNonUserCode]
|
|
public override string ToString()
|
|
{
|
|
return JsonFormatter.ToDiagnosticString(this);
|
|
}
|
|
|
|
// Token: 0x06000239 RID: 569 RVA: 0x0000A024 File Offset: 0x00008224
|
|
[DebuggerNonUserCode]
|
|
public void WriteTo(CodedOutputStream output)
|
|
{
|
|
if (this.kindCase_ == Value.KindOneofCase.NullValue)
|
|
{
|
|
output.WriteRawTag(8);
|
|
output.WriteEnum((int)this.NullValue);
|
|
}
|
|
if (this.kindCase_ == Value.KindOneofCase.NumberValue)
|
|
{
|
|
output.WriteRawTag(17);
|
|
output.WriteDouble(this.NumberValue);
|
|
}
|
|
if (this.kindCase_ == Value.KindOneofCase.StringValue)
|
|
{
|
|
output.WriteRawTag(26);
|
|
output.WriteString(this.StringValue);
|
|
}
|
|
if (this.kindCase_ == Value.KindOneofCase.BoolValue)
|
|
{
|
|
output.WriteRawTag(32);
|
|
output.WriteBool(this.BoolValue);
|
|
}
|
|
if (this.kindCase_ == Value.KindOneofCase.StructValue)
|
|
{
|
|
output.WriteRawTag(42);
|
|
output.WriteMessage(this.StructValue);
|
|
}
|
|
if (this.kindCase_ == Value.KindOneofCase.ListValue)
|
|
{
|
|
output.WriteRawTag(50);
|
|
output.WriteMessage(this.ListValue);
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600023A RID: 570 RVA: 0x0000A0E0 File Offset: 0x000082E0
|
|
[DebuggerNonUserCode]
|
|
public int CalculateSize()
|
|
{
|
|
int num = 0;
|
|
if (this.kindCase_ == Value.KindOneofCase.NullValue)
|
|
{
|
|
num += 1 + CodedOutputStream.ComputeEnumSize((int)this.NullValue);
|
|
}
|
|
if (this.kindCase_ == Value.KindOneofCase.NumberValue)
|
|
{
|
|
num += 9;
|
|
}
|
|
if (this.kindCase_ == Value.KindOneofCase.StringValue)
|
|
{
|
|
num += 1 + CodedOutputStream.ComputeStringSize(this.StringValue);
|
|
}
|
|
if (this.kindCase_ == Value.KindOneofCase.BoolValue)
|
|
{
|
|
num += 2;
|
|
}
|
|
if (this.kindCase_ == Value.KindOneofCase.StructValue)
|
|
{
|
|
num += 1 + CodedOutputStream.ComputeMessageSize(this.StructValue);
|
|
}
|
|
if (this.kindCase_ == Value.KindOneofCase.ListValue)
|
|
{
|
|
num += 1 + CodedOutputStream.ComputeMessageSize(this.ListValue);
|
|
}
|
|
return num;
|
|
}
|
|
|
|
// Token: 0x0600023B RID: 571 RVA: 0x0000A170 File Offset: 0x00008370
|
|
[DebuggerNonUserCode]
|
|
public void MergeFrom(Value other)
|
|
{
|
|
if (other == null)
|
|
{
|
|
return;
|
|
}
|
|
switch (other.KindCase)
|
|
{
|
|
case Value.KindOneofCase.NullValue:
|
|
this.NullValue = other.NullValue;
|
|
return;
|
|
case Value.KindOneofCase.NumberValue:
|
|
this.NumberValue = other.NumberValue;
|
|
return;
|
|
case Value.KindOneofCase.StringValue:
|
|
this.StringValue = other.StringValue;
|
|
return;
|
|
case Value.KindOneofCase.BoolValue:
|
|
this.BoolValue = other.BoolValue;
|
|
return;
|
|
case Value.KindOneofCase.StructValue:
|
|
this.StructValue = other.StructValue;
|
|
return;
|
|
case Value.KindOneofCase.ListValue:
|
|
this.ListValue = other.ListValue;
|
|
return;
|
|
default:
|
|
return;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600023C RID: 572 RVA: 0x0000A1F8 File Offset: 0x000083F8
|
|
[DebuggerNonUserCode]
|
|
public void MergeFrom(CodedInputStream input)
|
|
{
|
|
uint num;
|
|
while ((num = input.ReadTag()) != 0U)
|
|
{
|
|
if (num <= 26U)
|
|
{
|
|
if (num == 8U)
|
|
{
|
|
this.kind_ = input.ReadEnum();
|
|
this.kindCase_ = Value.KindOneofCase.NullValue;
|
|
continue;
|
|
}
|
|
if (num == 17U)
|
|
{
|
|
this.NumberValue = input.ReadDouble();
|
|
continue;
|
|
}
|
|
if (num == 26U)
|
|
{
|
|
this.StringValue = input.ReadString();
|
|
continue;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (num == 32U)
|
|
{
|
|
this.BoolValue = input.ReadBool();
|
|
continue;
|
|
}
|
|
if (num == 42U)
|
|
{
|
|
Struct @struct = new Struct();
|
|
if (this.kindCase_ == Value.KindOneofCase.StructValue)
|
|
{
|
|
@struct.MergeFrom(this.StructValue);
|
|
}
|
|
input.ReadMessage(@struct);
|
|
this.StructValue = @struct;
|
|
continue;
|
|
}
|
|
if (num == 50U)
|
|
{
|
|
ListValue listValue = new ListValue();
|
|
if (this.kindCase_ == Value.KindOneofCase.ListValue)
|
|
{
|
|
listValue.MergeFrom(this.ListValue);
|
|
}
|
|
input.ReadMessage(listValue);
|
|
this.ListValue = listValue;
|
|
continue;
|
|
}
|
|
}
|
|
input.SkipLastField();
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600023D RID: 573 RVA: 0x0000A2DE File Offset: 0x000084DE
|
|
public static Value ForString(string value)
|
|
{
|
|
ProtoPreconditions.CheckNotNull<string>(value, "value");
|
|
return new Value
|
|
{
|
|
StringValue = value
|
|
};
|
|
}
|
|
|
|
// Token: 0x0600023E RID: 574 RVA: 0x0000A2F8 File Offset: 0x000084F8
|
|
public static Value ForNumber(double value)
|
|
{
|
|
return new Value
|
|
{
|
|
NumberValue = value
|
|
};
|
|
}
|
|
|
|
// Token: 0x0600023F RID: 575 RVA: 0x0000A306 File Offset: 0x00008506
|
|
public static Value ForBool(bool value)
|
|
{
|
|
return new Value
|
|
{
|
|
BoolValue = value
|
|
};
|
|
}
|
|
|
|
// Token: 0x06000240 RID: 576 RVA: 0x0000A314 File Offset: 0x00008514
|
|
public static Value ForNull()
|
|
{
|
|
return new Value
|
|
{
|
|
NullValue = NullValue.NullValue
|
|
};
|
|
}
|
|
|
|
// Token: 0x06000241 RID: 577 RVA: 0x0000A322 File Offset: 0x00008522
|
|
public static Value ForList(params Value[] values)
|
|
{
|
|
ProtoPreconditions.CheckNotNull<Value[]>(values, "values");
|
|
return new Value
|
|
{
|
|
ListValue = new ListValue
|
|
{
|
|
Values = { values }
|
|
}
|
|
};
|
|
}
|
|
|
|
// Token: 0x06000242 RID: 578 RVA: 0x0000A34C File Offset: 0x0000854C
|
|
public static Value ForStruct(Struct value)
|
|
{
|
|
ProtoPreconditions.CheckNotNull<Struct>(value, "value");
|
|
return new Value
|
|
{
|
|
StructValue = value
|
|
};
|
|
}
|
|
|
|
// Token: 0x0400009B RID: 155
|
|
private static readonly MessageParser<Value> _parser = new MessageParser<Value>(() => new Value());
|
|
|
|
// Token: 0x0400009C RID: 156
|
|
public const int NullValueFieldNumber = 1;
|
|
|
|
// Token: 0x0400009D RID: 157
|
|
public const int NumberValueFieldNumber = 2;
|
|
|
|
// Token: 0x0400009E RID: 158
|
|
public const int StringValueFieldNumber = 3;
|
|
|
|
// Token: 0x0400009F RID: 159
|
|
public const int BoolValueFieldNumber = 4;
|
|
|
|
// Token: 0x040000A0 RID: 160
|
|
public const int StructValueFieldNumber = 5;
|
|
|
|
// Token: 0x040000A1 RID: 161
|
|
public const int ListValueFieldNumber = 6;
|
|
|
|
// Token: 0x040000A2 RID: 162
|
|
private object kind_;
|
|
|
|
// Token: 0x040000A3 RID: 163
|
|
private Value.KindOneofCase kindCase_;
|
|
|
|
// Token: 0x0200008F RID: 143
|
|
public enum KindOneofCase
|
|
{
|
|
// Token: 0x040002C5 RID: 709
|
|
None,
|
|
// Token: 0x040002C6 RID: 710
|
|
NullValue,
|
|
// Token: 0x040002C7 RID: 711
|
|
NumberValue,
|
|
// Token: 0x040002C8 RID: 712
|
|
StringValue,
|
|
// Token: 0x040002C9 RID: 713
|
|
BoolValue,
|
|
// Token: 0x040002CA RID: 714
|
|
StructValue,
|
|
// Token: 0x040002CB RID: 715
|
|
ListValue
|
|
}
|
|
}
|
|
}
|