summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/ProtoBuf/ProtoContractAttribute.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/ProtoBuf/ProtoContractAttribute.cs')
-rw-r--r--Client/Assets/Scripts/XMainClient/ProtoBuf/ProtoContractAttribute.cs194
1 files changed, 194 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/ProtoBuf/ProtoContractAttribute.cs b/Client/Assets/Scripts/XMainClient/ProtoBuf/ProtoContractAttribute.cs
new file mode 100644
index 00000000..ee0e6152
--- /dev/null
+++ b/Client/Assets/Scripts/XMainClient/ProtoBuf/ProtoContractAttribute.cs
@@ -0,0 +1,194 @@
+using System;
+
+namespace ProtoBuf
+{
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
+ public sealed class ProtoContractAttribute : Attribute
+ {
+ public string Name
+ {
+ get
+ {
+ return this.name;
+ }
+ set
+ {
+ this.name = value;
+ }
+ }
+
+ public int ImplicitFirstTag
+ {
+ get
+ {
+ return this.implicitFirstTag;
+ }
+ set
+ {
+ bool flag = value < 1;
+ if (flag)
+ {
+ throw new ArgumentOutOfRangeException("ImplicitFirstTag");
+ }
+ this.implicitFirstTag = value;
+ }
+ }
+
+ public bool UseProtoMembersOnly
+ {
+ get
+ {
+ return this.HasFlag(4);
+ }
+ set
+ {
+ this.SetFlag(4, value);
+ }
+ }
+
+ public bool IgnoreListHandling
+ {
+ get
+ {
+ return this.HasFlag(16);
+ }
+ set
+ {
+ this.SetFlag(16, value);
+ }
+ }
+
+ public ImplicitFields ImplicitFields
+ {
+ get
+ {
+ return this.implicitFields;
+ }
+ set
+ {
+ this.implicitFields = value;
+ }
+ }
+
+ public bool InferTagFromName
+ {
+ get
+ {
+ return this.HasFlag(1);
+ }
+ set
+ {
+ this.SetFlag(1, value);
+ this.SetFlag(2, true);
+ }
+ }
+
+ internal bool InferTagFromNameHasValue
+ {
+ get
+ {
+ return this.HasFlag(2);
+ }
+ }
+
+ public int DataMemberOffset
+ {
+ get
+ {
+ return this.dataMemberOffset;
+ }
+ set
+ {
+ this.dataMemberOffset = value;
+ }
+ }
+
+ public bool SkipConstructor
+ {
+ get
+ {
+ return this.HasFlag(8);
+ }
+ set
+ {
+ this.SetFlag(8, value);
+ }
+ }
+
+ public bool AsReferenceDefault
+ {
+ get
+ {
+ return this.HasFlag(32);
+ }
+ set
+ {
+ this.SetFlag(32, value);
+ }
+ }
+
+ public bool EnumPassthru
+ {
+ get
+ {
+ return this.HasFlag(64);
+ }
+ set
+ {
+ this.SetFlag(64, value);
+ this.SetFlag(128, true);
+ }
+ }
+
+ internal bool EnumPassthruHasValue
+ {
+ get
+ {
+ return this.HasFlag(128);
+ }
+ }
+
+ private string name;
+
+ private int implicitFirstTag;
+
+ private ImplicitFields implicitFields;
+
+ private int dataMemberOffset;
+
+ private byte flags;
+
+ private const byte OPTIONS_InferTagFromName = 1;
+
+ private const byte OPTIONS_InferTagFromNameHasValue = 2;
+
+ private const byte OPTIONS_UseProtoMembersOnly = 4;
+
+ private const byte OPTIONS_SkipConstructor = 8;
+
+ private const byte OPTIONS_IgnoreListHandling = 16;
+
+ private const byte OPTIONS_AsReferenceDefault = 32;
+
+ private const byte OPTIONS_EnumPassthru = 64;
+
+ private const byte OPTIONS_EnumPassthruHasValue = 128;
+
+ private bool HasFlag(byte flag)
+ {
+ return (this.flags & flag) == flag;
+ }
+
+ private void SetFlag(byte flag, bool value)
+ {
+ if (value)
+ {
+ this.flags |= flag;
+ }
+ else
+ {
+ this.flags &= (byte)~flag;
+ }
+ }
+ }
+}