summaryrefslogtreecommitdiff
path: root/csharp/src/Google.Protobuf/Reflection
diff options
context:
space:
mode:
Diffstat (limited to 'csharp/src/Google.Protobuf/Reflection')
-rw-r--r--csharp/src/Google.Protobuf/Reflection/Descriptor.cs5991
-rw-r--r--csharp/src/Google.Protobuf/Reflection/DescriptorBase.cs85
-rw-r--r--csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs368
-rw-r--r--csharp/src/Google.Protobuf/Reflection/DescriptorUtil.cs64
-rw-r--r--csharp/src/Google.Protobuf/Reflection/DescriptorValidationException.cs80
-rw-r--r--csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs116
-rw-r--r--csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs70
-rw-r--r--csharp/src/Google.Protobuf/Reflection/FieldAccessorBase.cs63
-rw-r--r--csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs343
-rw-r--r--csharp/src/Google.Protobuf/Reflection/FieldType.cs113
-rw-r--r--csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs344
-rw-r--r--csharp/src/Google.Protobuf/Reflection/GeneratedClrTypeInfo.cs103
-rw-r--r--csharp/src/Google.Protobuf/Reflection/IDescriptor.cs55
-rw-r--r--csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs71
-rw-r--r--csharp/src/Google.Protobuf/Reflection/MapFieldAccessor.cs59
-rw-r--r--csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs321
-rw-r--r--csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs103
-rw-r--r--csharp/src/Google.Protobuf/Reflection/OneofAccessor.cs90
-rw-r--r--csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs122
-rw-r--r--csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs58
-rw-r--r--csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs68
-rw-r--r--csharp/src/Google.Protobuf/Reflection/PartialClasses.cs59
-rw-r--r--csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs107
-rw-r--r--csharp/src/Google.Protobuf/Reflection/RepeatedFieldAccessor.cs60
-rw-r--r--csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs89
-rw-r--r--csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs81
-rw-r--r--csharp/src/Google.Protobuf/Reflection/TypeRegistry.cs183
27 files changed, 9266 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs
new file mode 100644
index 00000000..7ce75739
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs
@@ -0,0 +1,5991 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/protobuf/descriptor.proto
+#pragma warning disable 1591, 0612, 3021
+#region Designer generated code
+
+using pb = global::Google.Protobuf;
+using pbc = global::Google.Protobuf.Collections;
+using pbr = global::Google.Protobuf.Reflection;
+using scg = global::System.Collections.Generic;
+namespace Google.Protobuf.Reflection {
+
+ /// <summary>Holder for reflection information generated from google/protobuf/descriptor.proto</summary>
+ internal static partial class DescriptorReflection {
+
+ #region Descriptor
+ /// <summary>File descriptor for google/protobuf/descriptor.proto</summary>
+ public static pbr::FileDescriptor Descriptor {
+ get { return descriptor; }
+ }
+ private static pbr::FileDescriptor descriptor;
+
+ static DescriptorReflection() {
+ byte[] descriptorData = global::System.Convert.FromBase64String(
+ string.Concat(
+ "CiBnb29nbGUvcHJvdG9idWYvZGVzY3JpcHRvci5wcm90bxIPZ29vZ2xlLnBy",
+ "b3RvYnVmIkcKEUZpbGVEZXNjcmlwdG9yU2V0EjIKBGZpbGUYASADKAsyJC5n",
+ "b29nbGUucHJvdG9idWYuRmlsZURlc2NyaXB0b3JQcm90byLbAwoTRmlsZURl",
+ "c2NyaXB0b3JQcm90bxIMCgRuYW1lGAEgASgJEg8KB3BhY2thZ2UYAiABKAkS",
+ "EgoKZGVwZW5kZW5jeRgDIAMoCRIZChFwdWJsaWNfZGVwZW5kZW5jeRgKIAMo",
+ "BRIXCg93ZWFrX2RlcGVuZGVuY3kYCyADKAUSNgoMbWVzc2FnZV90eXBlGAQg",
+ "AygLMiAuZ29vZ2xlLnByb3RvYnVmLkRlc2NyaXB0b3JQcm90bxI3CgllbnVt",
+ "X3R5cGUYBSADKAsyJC5nb29nbGUucHJvdG9idWYuRW51bURlc2NyaXB0b3JQ",
+ "cm90bxI4CgdzZXJ2aWNlGAYgAygLMicuZ29vZ2xlLnByb3RvYnVmLlNlcnZp",
+ "Y2VEZXNjcmlwdG9yUHJvdG8SOAoJZXh0ZW5zaW9uGAcgAygLMiUuZ29vZ2xl",
+ "LnByb3RvYnVmLkZpZWxkRGVzY3JpcHRvclByb3RvEi0KB29wdGlvbnMYCCAB",
+ "KAsyHC5nb29nbGUucHJvdG9idWYuRmlsZU9wdGlvbnMSOQoQc291cmNlX2Nv",
+ "ZGVfaW5mbxgJIAEoCzIfLmdvb2dsZS5wcm90b2J1Zi5Tb3VyY2VDb2RlSW5m",
+ "bxIOCgZzeW50YXgYDCABKAki8AQKD0Rlc2NyaXB0b3JQcm90bxIMCgRuYW1l",
+ "GAEgASgJEjQKBWZpZWxkGAIgAygLMiUuZ29vZ2xlLnByb3RvYnVmLkZpZWxk",
+ "RGVzY3JpcHRvclByb3RvEjgKCWV4dGVuc2lvbhgGIAMoCzIlLmdvb2dsZS5w",
+ "cm90b2J1Zi5GaWVsZERlc2NyaXB0b3JQcm90bxI1CgtuZXN0ZWRfdHlwZRgD",
+ "IAMoCzIgLmdvb2dsZS5wcm90b2J1Zi5EZXNjcmlwdG9yUHJvdG8SNwoJZW51",
+ "bV90eXBlGAQgAygLMiQuZ29vZ2xlLnByb3RvYnVmLkVudW1EZXNjcmlwdG9y",
+ "UHJvdG8SSAoPZXh0ZW5zaW9uX3JhbmdlGAUgAygLMi8uZ29vZ2xlLnByb3Rv",
+ "YnVmLkRlc2NyaXB0b3JQcm90by5FeHRlbnNpb25SYW5nZRI5CgpvbmVvZl9k",
+ "ZWNsGAggAygLMiUuZ29vZ2xlLnByb3RvYnVmLk9uZW9mRGVzY3JpcHRvclBy",
+ "b3RvEjAKB29wdGlvbnMYByABKAsyHy5nb29nbGUucHJvdG9idWYuTWVzc2Fn",
+ "ZU9wdGlvbnMSRgoOcmVzZXJ2ZWRfcmFuZ2UYCSADKAsyLi5nb29nbGUucHJv",
+ "dG9idWYuRGVzY3JpcHRvclByb3RvLlJlc2VydmVkUmFuZ2USFQoNcmVzZXJ2",
+ "ZWRfbmFtZRgKIAMoCRosCg5FeHRlbnNpb25SYW5nZRINCgVzdGFydBgBIAEo",
+ "BRILCgNlbmQYAiABKAUaKwoNUmVzZXJ2ZWRSYW5nZRINCgVzdGFydBgBIAEo",
+ "BRILCgNlbmQYAiABKAUivAUKFEZpZWxkRGVzY3JpcHRvclByb3RvEgwKBG5h",
+ "bWUYASABKAkSDgoGbnVtYmVyGAMgASgFEjoKBWxhYmVsGAQgASgOMisuZ29v",
+ "Z2xlLnByb3RvYnVmLkZpZWxkRGVzY3JpcHRvclByb3RvLkxhYmVsEjgKBHR5",
+ "cGUYBSABKA4yKi5nb29nbGUucHJvdG9idWYuRmllbGREZXNjcmlwdG9yUHJv",
+ "dG8uVHlwZRIRCgl0eXBlX25hbWUYBiABKAkSEAoIZXh0ZW5kZWUYAiABKAkS",
+ "FQoNZGVmYXVsdF92YWx1ZRgHIAEoCRITCgtvbmVvZl9pbmRleBgJIAEoBRIR",
+ "Cglqc29uX25hbWUYCiABKAkSLgoHb3B0aW9ucxgIIAEoCzIdLmdvb2dsZS5w",
+ "cm90b2J1Zi5GaWVsZE9wdGlvbnMitgIKBFR5cGUSDwoLVFlQRV9ET1VCTEUQ",
+ "ARIOCgpUWVBFX0ZMT0FUEAISDgoKVFlQRV9JTlQ2NBADEg8KC1RZUEVfVUlO",
+ "VDY0EAQSDgoKVFlQRV9JTlQzMhAFEhAKDFRZUEVfRklYRUQ2NBAGEhAKDFRZ",
+ "UEVfRklYRUQzMhAHEg0KCVRZUEVfQk9PTBAIEg8KC1RZUEVfU1RSSU5HEAkS",
+ "DgoKVFlQRV9HUk9VUBAKEhAKDFRZUEVfTUVTU0FHRRALEg4KClRZUEVfQllU",
+ "RVMQDBIPCgtUWVBFX1VJTlQzMhANEg0KCVRZUEVfRU5VTRAOEhEKDVRZUEVf",
+ "U0ZJWEVEMzIQDxIRCg1UWVBFX1NGSVhFRDY0EBASDwoLVFlQRV9TSU5UMzIQ",
+ "ERIPCgtUWVBFX1NJTlQ2NBASIkMKBUxhYmVsEhIKDkxBQkVMX09QVElPTkFM",
+ "EAESEgoOTEFCRUxfUkVRVUlSRUQQAhISCg5MQUJFTF9SRVBFQVRFRBADIlQK",
+ "FE9uZW9mRGVzY3JpcHRvclByb3RvEgwKBG5hbWUYASABKAkSLgoHb3B0aW9u",
+ "cxgCIAEoCzIdLmdvb2dsZS5wcm90b2J1Zi5PbmVvZk9wdGlvbnMijAEKE0Vu",
+ "dW1EZXNjcmlwdG9yUHJvdG8SDAoEbmFtZRgBIAEoCRI4CgV2YWx1ZRgCIAMo",
+ "CzIpLmdvb2dsZS5wcm90b2J1Zi5FbnVtVmFsdWVEZXNjcmlwdG9yUHJvdG8S",
+ "LQoHb3B0aW9ucxgDIAEoCzIcLmdvb2dsZS5wcm90b2J1Zi5FbnVtT3B0aW9u",
+ "cyJsChhFbnVtVmFsdWVEZXNjcmlwdG9yUHJvdG8SDAoEbmFtZRgBIAEoCRIO",
+ "CgZudW1iZXIYAiABKAUSMgoHb3B0aW9ucxgDIAEoCzIhLmdvb2dsZS5wcm90",
+ "b2J1Zi5FbnVtVmFsdWVPcHRpb25zIpABChZTZXJ2aWNlRGVzY3JpcHRvclBy",
+ "b3RvEgwKBG5hbWUYASABKAkSNgoGbWV0aG9kGAIgAygLMiYuZ29vZ2xlLnBy",
+ "b3RvYnVmLk1ldGhvZERlc2NyaXB0b3JQcm90bxIwCgdvcHRpb25zGAMgASgL",
+ "Mh8uZ29vZ2xlLnByb3RvYnVmLlNlcnZpY2VPcHRpb25zIsEBChVNZXRob2RE",
+ "ZXNjcmlwdG9yUHJvdG8SDAoEbmFtZRgBIAEoCRISCgppbnB1dF90eXBlGAIg",
+ "ASgJEhMKC291dHB1dF90eXBlGAMgASgJEi8KB29wdGlvbnMYBCABKAsyHi5n",
+ "b29nbGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucxIfChBjbGllbnRfc3RyZWFt",
+ "aW5nGAUgASgIOgVmYWxzZRIfChBzZXJ2ZXJfc3RyZWFtaW5nGAYgASgIOgVm",
+ "YWxzZSKHBQoLRmlsZU9wdGlvbnMSFAoMamF2YV9wYWNrYWdlGAEgASgJEhwK",
+ "FGphdmFfb3V0ZXJfY2xhc3NuYW1lGAggASgJEiIKE2phdmFfbXVsdGlwbGVf",
+ "ZmlsZXMYCiABKAg6BWZhbHNlEiwKHWphdmFfZ2VuZXJhdGVfZXF1YWxzX2Fu",
+ "ZF9oYXNoGBQgASgIOgVmYWxzZRIlChZqYXZhX3N0cmluZ19jaGVja191dGY4",
+ "GBsgASgIOgVmYWxzZRJGCgxvcHRpbWl6ZV9mb3IYCSABKA4yKS5nb29nbGUu",
+ "cHJvdG9idWYuRmlsZU9wdGlvbnMuT3B0aW1pemVNb2RlOgVTUEVFRBISCgpn",
+ "b19wYWNrYWdlGAsgASgJEiIKE2NjX2dlbmVyaWNfc2VydmljZXMYECABKAg6",
+ "BWZhbHNlEiQKFWphdmFfZ2VuZXJpY19zZXJ2aWNlcxgRIAEoCDoFZmFsc2US",
+ "IgoTcHlfZ2VuZXJpY19zZXJ2aWNlcxgSIAEoCDoFZmFsc2USGQoKZGVwcmVj",
+ "YXRlZBgXIAEoCDoFZmFsc2USHwoQY2NfZW5hYmxlX2FyZW5hcxgfIAEoCDoF",
+ "ZmFsc2USGQoRb2JqY19jbGFzc19wcmVmaXgYJCABKAkSGAoQY3NoYXJwX25h",
+ "bWVzcGFjZRglIAEoCRJDChR1bmludGVycHJldGVkX29wdGlvbhjnByADKAsy",
+ "JC5nb29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlvbiI6CgxPcHRp",
+ "bWl6ZU1vZGUSCQoFU1BFRUQQARINCglDT0RFX1NJWkUQAhIQCgxMSVRFX1JV",
+ "TlRJTUUQAyoJCOgHEICAgIACSgQIJhAnIuYBCg5NZXNzYWdlT3B0aW9ucxIm",
+ "ChdtZXNzYWdlX3NldF93aXJlX2Zvcm1hdBgBIAEoCDoFZmFsc2USLgofbm9f",
+ "c3RhbmRhcmRfZGVzY3JpcHRvcl9hY2Nlc3NvchgCIAEoCDoFZmFsc2USGQoK",
+ "ZGVwcmVjYXRlZBgDIAEoCDoFZmFsc2USEQoJbWFwX2VudHJ5GAcgASgIEkMK",
+ "FHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1",
+ "Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIimAMKDEZpZWxkT3B0",
+ "aW9ucxI6CgVjdHlwZRgBIAEoDjIjLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE9w",
+ "dGlvbnMuQ1R5cGU6BlNUUklORxIOCgZwYWNrZWQYAiABKAgSPwoGanN0eXBl",
+ "GAYgASgOMiQuZ29vZ2xlLnByb3RvYnVmLkZpZWxkT3B0aW9ucy5KU1R5cGU6",
+ "CUpTX05PUk1BTBITCgRsYXp5GAUgASgIOgVmYWxzZRIZCgpkZXByZWNhdGVk",
+ "GAMgASgIOgVmYWxzZRITCgR3ZWFrGAogASgIOgVmYWxzZRJDChR1bmludGVy",
+ "cHJldGVkX29wdGlvbhjnByADKAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRl",
+ "cnByZXRlZE9wdGlvbiIvCgVDVHlwZRIKCgZTVFJJTkcQABIICgRDT1JEEAES",
+ "EAoMU1RSSU5HX1BJRUNFEAIiNQoGSlNUeXBlEg0KCUpTX05PUk1BTBAAEg0K",
+ "CUpTX1NUUklORxABEg0KCUpTX05VTUJFUhACKgkI6AcQgICAgAIiXgoMT25l",
+ "b2ZPcHRpb25zEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdv",
+ "b2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIi",
+ "jQEKC0VudW1PcHRpb25zEhMKC2FsbG93X2FsaWFzGAIgASgIEhkKCmRlcHJl",
+ "Y2F0ZWQYAyABKAg6BWZhbHNlEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcH",
+ "IAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI",
+ "6AcQgICAgAIifQoQRW51bVZhbHVlT3B0aW9ucxIZCgpkZXByZWNhdGVkGAEg",
+ "ASgIOgVmYWxzZRJDChR1bmludGVycHJldGVkX29wdGlvbhjnByADKAsyJC5n",
+ "b29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlvbioJCOgHEICAgIAC",
+ "InsKDlNlcnZpY2VPcHRpb25zEhkKCmRlcHJlY2F0ZWQYISABKAg6BWZhbHNl",
+ "EkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90",
+ "b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIiegoNTWV0aG9k",
+ "T3B0aW9ucxIZCgpkZXByZWNhdGVkGCEgASgIOgVmYWxzZRJDChR1bmludGVy",
+ "cHJldGVkX29wdGlvbhjnByADKAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRl",
+ "cnByZXRlZE9wdGlvbioJCOgHEICAgIACIp4CChNVbmludGVycHJldGVkT3B0",
+ "aW9uEjsKBG5hbWUYAiADKAsyLS5nb29nbGUucHJvdG9idWYuVW5pbnRlcnBy",
+ "ZXRlZE9wdGlvbi5OYW1lUGFydBIYChBpZGVudGlmaWVyX3ZhbHVlGAMgASgJ",
+ "EhoKEnBvc2l0aXZlX2ludF92YWx1ZRgEIAEoBBIaChJuZWdhdGl2ZV9pbnRf",
+ "dmFsdWUYBSABKAMSFAoMZG91YmxlX3ZhbHVlGAYgASgBEhQKDHN0cmluZ192",
+ "YWx1ZRgHIAEoDBIXCg9hZ2dyZWdhdGVfdmFsdWUYCCABKAkaMwoITmFtZVBh",
+ "cnQSEQoJbmFtZV9wYXJ0GAEgAigJEhQKDGlzX2V4dGVuc2lvbhgCIAIoCCLV",
+ "AQoOU291cmNlQ29kZUluZm8SOgoIbG9jYXRpb24YASADKAsyKC5nb29nbGUu",
+ "cHJvdG9idWYuU291cmNlQ29kZUluZm8uTG9jYXRpb24ahgEKCExvY2F0aW9u",
+ "EhAKBHBhdGgYASADKAVCAhABEhAKBHNwYW4YAiADKAVCAhABEhgKEGxlYWRp",
+ "bmdfY29tbWVudHMYAyABKAkSGQoRdHJhaWxpbmdfY29tbWVudHMYBCABKAkS",
+ "IQoZbGVhZGluZ19kZXRhY2hlZF9jb21tZW50cxgGIAMoCSKnAQoRR2VuZXJh",
+ "dGVkQ29kZUluZm8SQQoKYW5ub3RhdGlvbhgBIAMoCzItLmdvb2dsZS5wcm90",
+ "b2J1Zi5HZW5lcmF0ZWRDb2RlSW5mby5Bbm5vdGF0aW9uGk8KCkFubm90YXRp",
+ "b24SEAoEcGF0aBgBIAMoBUICEAESEwoLc291cmNlX2ZpbGUYAiABKAkSDQoF",
+ "YmVnaW4YAyABKAUSCwoDZW5kGAQgASgFQlgKE2NvbS5nb29nbGUucHJvdG9i",
+ "dWZCEERlc2NyaXB0b3JQcm90b3NIAVoKZGVzY3JpcHRvcqICA0dQQqoCGkdv",
+ "b2dsZS5Qcm90b2J1Zi5SZWZsZWN0aW9u"));
+ descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
+ new pbr::FileDescriptor[] { },
+ new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileDescriptorSet), global::Google.Protobuf.Reflection.FileDescriptorSet.Parser, new[]{ "File" }, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileDescriptorProto), global::Google.Protobuf.Reflection.FileDescriptorProto.Parser, new[]{ "Name", "Package", "Dependency", "PublicDependency", "WeakDependency", "MessageType", "EnumType", "Service", "Extension", "Options", "SourceCodeInfo", "Syntax" }, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto), global::Google.Protobuf.Reflection.DescriptorProto.Parser, new[]{ "Name", "Field", "Extension", "NestedType", "EnumType", "ExtensionRange", "OneofDecl", "Options", "ReservedRange", "ReservedName" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange), global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange.Parser, new[]{ "Start", "End" }, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange), global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange.Parser, new[]{ "Start", "End" }, null, null, null)}),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto), global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser, new[]{ "Name", "Number", "Label", "Type", "TypeName", "Extendee", "DefaultValue", "OneofIndex", "JsonName", "Options" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type), typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label) }, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.OneofDescriptorProto), global::Google.Protobuf.Reflection.OneofDescriptorProto.Parser, new[]{ "Name", "Options" }, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumDescriptorProto), global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser, new[]{ "Name", "Value", "Options" }, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumValueDescriptorProto), global::Google.Protobuf.Reflection.EnumValueDescriptorProto.Parser, new[]{ "Name", "Number", "Options" }, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ServiceDescriptorProto), global::Google.Protobuf.Reflection.ServiceDescriptorProto.Parser, new[]{ "Name", "Method", "Options" }, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MethodDescriptorProto), global::Google.Protobuf.Reflection.MethodDescriptorProto.Parser, new[]{ "Name", "InputType", "OutputType", "Options", "ClientStreaming", "ServerStreaming" }, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileOptions), global::Google.Protobuf.Reflection.FileOptions.Parser, new[]{ "JavaPackage", "JavaOuterClassname", "JavaMultipleFiles", "JavaGenerateEqualsAndHash", "JavaStringCheckUtf8", "OptimizeFor", "GoPackage", "CcGenericServices", "JavaGenericServices", "PyGenericServices", "Deprecated", "CcEnableArenas", "ObjcClassPrefix", "CsharpNamespace", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) }, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MessageOptions), global::Google.Protobuf.Reflection.MessageOptions.Parser, new[]{ "MessageSetWireFormat", "NoStandardDescriptorAccessor", "Deprecated", "MapEntry", "UninterpretedOption" }, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FieldOptions), global::Google.Protobuf.Reflection.FieldOptions.Parser, new[]{ "Ctype", "Packed", "Jstype", "Lazy", "Deprecated", "Weak", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FieldOptions.Types.CType), typeof(global::Google.Protobuf.Reflection.FieldOptions.Types.JSType) }, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.OneofOptions), global::Google.Protobuf.Reflection.OneofOptions.Parser, new[]{ "UninterpretedOption" }, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumOptions), global::Google.Protobuf.Reflection.EnumOptions.Parser, new[]{ "AllowAlias", "Deprecated", "UninterpretedOption" }, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumValueOptions), global::Google.Protobuf.Reflection.EnumValueOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ServiceOptions), global::Google.Protobuf.Reflection.ServiceOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MethodOptions), global::Google.Protobuf.Reflection.MethodOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.UninterpretedOption), global::Google.Protobuf.Reflection.UninterpretedOption.Parser, new[]{ "Name", "IdentifierValue", "PositiveIntValue", "NegativeIntValue", "DoubleValue", "StringValue", "AggregateValue" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart), global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart.Parser, new[]{ "NamePart_", "IsExtension" }, null, null, null)}),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo), global::Google.Protobuf.Reflection.SourceCodeInfo.Parser, new[]{ "Location" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location), global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location.Parser, new[]{ "Path", "Span", "LeadingComments", "TrailingComments", "LeadingDetachedComments" }, null, null, null)}),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.GeneratedCodeInfo), global::Google.Protobuf.Reflection.GeneratedCodeInfo.Parser, new[]{ "Annotation" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation), global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation.Parser, new[]{ "Path", "SourceFile", "Begin", "End" }, null, null, null)})
+ }));
+ }
+ #endregion
+
+ }
+ #region Messages
+ /// <summary>
+ /// The protocol compiler can output a FileDescriptorSet containing the .proto
+ /// files it parses.
+ /// </summary>
+ internal sealed partial class FileDescriptorSet : pb::IMessage<FileDescriptorSet> {
+ private static readonly pb::MessageParser<FileDescriptorSet> _parser = new pb::MessageParser<FileDescriptorSet>(() => new FileDescriptorSet());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<FileDescriptorSet> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[0]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public FileDescriptorSet() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public FileDescriptorSet(FileDescriptorSet other) : this() {
+ file_ = other.file_.Clone();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public FileDescriptorSet Clone() {
+ return new FileDescriptorSet(this);
+ }
+
+ /// <summary>Field number for the "file" field.</summary>
+ public const int FileFieldNumber = 1;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.FileDescriptorProto> _repeated_file_codec
+ = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.FileDescriptorProto.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.FileDescriptorProto> file_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.FileDescriptorProto>();
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.FileDescriptorProto> File {
+ get { return file_; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as FileDescriptorSet);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(FileDescriptorSet other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if(!file_.Equals(other.file_)) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ hash ^= file_.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ file_.WriteTo(output, _repeated_file_codec);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ size += file_.CalculateSize(_repeated_file_codec);
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(FileDescriptorSet other) {
+ if (other == null) {
+ return;
+ }
+ file_.Add(other.file_);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 10: {
+ file_.AddEntriesFrom(input, _repeated_file_codec);
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ /// <summary>
+ /// Describes a complete .proto file.
+ /// </summary>
+ internal sealed partial class FileDescriptorProto : pb::IMessage<FileDescriptorProto> {
+ private static readonly pb::MessageParser<FileDescriptorProto> _parser = new pb::MessageParser<FileDescriptorProto>(() => new FileDescriptorProto());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<FileDescriptorProto> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[1]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public FileDescriptorProto() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public FileDescriptorProto(FileDescriptorProto other) : this() {
+ name_ = other.name_;
+ package_ = other.package_;
+ dependency_ = other.dependency_.Clone();
+ publicDependency_ = other.publicDependency_.Clone();
+ weakDependency_ = other.weakDependency_.Clone();
+ messageType_ = other.messageType_.Clone();
+ enumType_ = other.enumType_.Clone();
+ service_ = other.service_.Clone();
+ extension_ = other.extension_.Clone();
+ Options = other.options_ != null ? other.Options.Clone() : null;
+ SourceCodeInfo = other.sourceCodeInfo_ != null ? other.SourceCodeInfo.Clone() : null;
+ syntax_ = other.syntax_;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public FileDescriptorProto Clone() {
+ return new FileDescriptorProto(this);
+ }
+
+ /// <summary>Field number for the "name" field.</summary>
+ public const int NameFieldNumber = 1;
+ private string name_ = "";
+ /// <summary>
+ /// file name, relative to root of source tree
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string Name {
+ get { return name_; }
+ set {
+ name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "package" field.</summary>
+ public const int PackageFieldNumber = 2;
+ private string package_ = "";
+ /// <summary>
+ /// e.g. "foo", "foo.bar", etc.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string Package {
+ get { return package_; }
+ set {
+ package_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "dependency" field.</summary>
+ public const int DependencyFieldNumber = 3;
+ private static readonly pb::FieldCodec<string> _repeated_dependency_codec
+ = pb::FieldCodec.ForString(26);
+ private readonly pbc::RepeatedField<string> dependency_ = new pbc::RepeatedField<string>();
+ /// <summary>
+ /// Names of files imported by this file.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<string> Dependency {
+ get { return dependency_; }
+ }
+
+ /// <summary>Field number for the "public_dependency" field.</summary>
+ public const int PublicDependencyFieldNumber = 10;
+ private static readonly pb::FieldCodec<int> _repeated_publicDependency_codec
+ = pb::FieldCodec.ForInt32(80);
+ private readonly pbc::RepeatedField<int> publicDependency_ = new pbc::RepeatedField<int>();
+ /// <summary>
+ /// Indexes of the public imported files in the dependency list above.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<int> PublicDependency {
+ get { return publicDependency_; }
+ }
+
+ /// <summary>Field number for the "weak_dependency" field.</summary>
+ public const int WeakDependencyFieldNumber = 11;
+ private static readonly pb::FieldCodec<int> _repeated_weakDependency_codec
+ = pb::FieldCodec.ForInt32(88);
+ private readonly pbc::RepeatedField<int> weakDependency_ = new pbc::RepeatedField<int>();
+ /// <summary>
+ /// Indexes of the weak imported files in the dependency list.
+ /// For Google-internal migration only. Do not use.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<int> WeakDependency {
+ get { return weakDependency_; }
+ }
+
+ /// <summary>Field number for the "message_type" field.</summary>
+ public const int MessageTypeFieldNumber = 4;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.DescriptorProto> _repeated_messageType_codec
+ = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Reflection.DescriptorProto.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto> messageType_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto>();
+ /// <summary>
+ /// All top-level definitions in this file.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto> MessageType {
+ get { return messageType_; }
+ }
+
+ /// <summary>Field number for the "enum_type" field.</summary>
+ public const int EnumTypeFieldNumber = 5;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.EnumDescriptorProto> _repeated_enumType_codec
+ = pb::FieldCodec.ForMessage(42, global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto> enumType_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto>();
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto> EnumType {
+ get { return enumType_; }
+ }
+
+ /// <summary>Field number for the "service" field.</summary>
+ public const int ServiceFieldNumber = 6;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.ServiceDescriptorProto> _repeated_service_codec
+ = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.Reflection.ServiceDescriptorProto.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.ServiceDescriptorProto> service_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.ServiceDescriptorProto>();
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.ServiceDescriptorProto> Service {
+ get { return service_; }
+ }
+
+ /// <summary>Field number for the "extension" field.</summary>
+ public const int ExtensionFieldNumber = 7;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.FieldDescriptorProto> _repeated_extension_codec
+ = pb::FieldCodec.ForMessage(58, global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> extension_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto>();
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> Extension {
+ get { return extension_; }
+ }
+
+ /// <summary>Field number for the "options" field.</summary>
+ public const int OptionsFieldNumber = 8;
+ private global::Google.Protobuf.Reflection.FileOptions options_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public global::Google.Protobuf.Reflection.FileOptions Options {
+ get { return options_; }
+ set {
+ options_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "source_code_info" field.</summary>
+ public const int SourceCodeInfoFieldNumber = 9;
+ private global::Google.Protobuf.Reflection.SourceCodeInfo sourceCodeInfo_;
+ /// <summary>
+ /// This field contains optional information about the original source code.
+ /// You may safely remove this entire field without harming runtime
+ /// functionality of the descriptors -- the information is needed only by
+ /// development tools.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public global::Google.Protobuf.Reflection.SourceCodeInfo SourceCodeInfo {
+ get { return sourceCodeInfo_; }
+ set {
+ sourceCodeInfo_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "syntax" field.</summary>
+ public const int SyntaxFieldNumber = 12;
+ private string syntax_ = "";
+ /// <summary>
+ /// The syntax of the proto file.
+ /// The supported values are "proto2" and "proto3".
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string Syntax {
+ get { return syntax_; }
+ set {
+ syntax_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as FileDescriptorProto);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(FileDescriptorProto other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (Name != other.Name) return false;
+ if (Package != other.Package) return false;
+ if(!dependency_.Equals(other.dependency_)) return false;
+ if(!publicDependency_.Equals(other.publicDependency_)) return false;
+ if(!weakDependency_.Equals(other.weakDependency_)) return false;
+ if(!messageType_.Equals(other.messageType_)) return false;
+ if(!enumType_.Equals(other.enumType_)) return false;
+ if(!service_.Equals(other.service_)) return false;
+ if(!extension_.Equals(other.extension_)) return false;
+ if (!object.Equals(Options, other.Options)) return false;
+ if (!object.Equals(SourceCodeInfo, other.SourceCodeInfo)) return false;
+ if (Syntax != other.Syntax) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Name.Length != 0) hash ^= Name.GetHashCode();
+ if (Package.Length != 0) hash ^= Package.GetHashCode();
+ hash ^= dependency_.GetHashCode();
+ hash ^= publicDependency_.GetHashCode();
+ hash ^= weakDependency_.GetHashCode();
+ hash ^= messageType_.GetHashCode();
+ hash ^= enumType_.GetHashCode();
+ hash ^= service_.GetHashCode();
+ hash ^= extension_.GetHashCode();
+ if (options_ != null) hash ^= Options.GetHashCode();
+ if (sourceCodeInfo_ != null) hash ^= SourceCodeInfo.GetHashCode();
+ if (Syntax.Length != 0) hash ^= Syntax.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Name.Length != 0) {
+ output.WriteRawTag(10);
+ output.WriteString(Name);
+ }
+ if (Package.Length != 0) {
+ output.WriteRawTag(18);
+ output.WriteString(Package);
+ }
+ dependency_.WriteTo(output, _repeated_dependency_codec);
+ messageType_.WriteTo(output, _repeated_messageType_codec);
+ enumType_.WriteTo(output, _repeated_enumType_codec);
+ service_.WriteTo(output, _repeated_service_codec);
+ extension_.WriteTo(output, _repeated_extension_codec);
+ if (options_ != null) {
+ output.WriteRawTag(66);
+ output.WriteMessage(Options);
+ }
+ if (sourceCodeInfo_ != null) {
+ output.WriteRawTag(74);
+ output.WriteMessage(SourceCodeInfo);
+ }
+ publicDependency_.WriteTo(output, _repeated_publicDependency_codec);
+ weakDependency_.WriteTo(output, _repeated_weakDependency_codec);
+ if (Syntax.Length != 0) {
+ output.WriteRawTag(98);
+ output.WriteString(Syntax);
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (Name.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
+ }
+ if (Package.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(Package);
+ }
+ size += dependency_.CalculateSize(_repeated_dependency_codec);
+ size += publicDependency_.CalculateSize(_repeated_publicDependency_codec);
+ size += weakDependency_.CalculateSize(_repeated_weakDependency_codec);
+ size += messageType_.CalculateSize(_repeated_messageType_codec);
+ size += enumType_.CalculateSize(_repeated_enumType_codec);
+ size += service_.CalculateSize(_repeated_service_codec);
+ size += extension_.CalculateSize(_repeated_extension_codec);
+ if (options_ != null) {
+ size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
+ }
+ if (sourceCodeInfo_ != null) {
+ size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceCodeInfo);
+ }
+ if (Syntax.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(Syntax);
+ }
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(FileDescriptorProto other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Name.Length != 0) {
+ Name = other.Name;
+ }
+ if (other.Package.Length != 0) {
+ Package = other.Package;
+ }
+ dependency_.Add(other.dependency_);
+ publicDependency_.Add(other.publicDependency_);
+ weakDependency_.Add(other.weakDependency_);
+ messageType_.Add(other.messageType_);
+ enumType_.Add(other.enumType_);
+ service_.Add(other.service_);
+ extension_.Add(other.extension_);
+ if (other.options_ != null) {
+ if (options_ == null) {
+ options_ = new global::Google.Protobuf.Reflection.FileOptions();
+ }
+ Options.MergeFrom(other.Options);
+ }
+ if (other.sourceCodeInfo_ != null) {
+ if (sourceCodeInfo_ == null) {
+ sourceCodeInfo_ = new global::Google.Protobuf.Reflection.SourceCodeInfo();
+ }
+ SourceCodeInfo.MergeFrom(other.SourceCodeInfo);
+ }
+ if (other.Syntax.Length != 0) {
+ Syntax = other.Syntax;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 10: {
+ Name = input.ReadString();
+ break;
+ }
+ case 18: {
+ Package = input.ReadString();
+ break;
+ }
+ case 26: {
+ dependency_.AddEntriesFrom(input, _repeated_dependency_codec);
+ break;
+ }
+ case 34: {
+ messageType_.AddEntriesFrom(input, _repeated_messageType_codec);
+ break;
+ }
+ case 42: {
+ enumType_.AddEntriesFrom(input, _repeated_enumType_codec);
+ break;
+ }
+ case 50: {
+ service_.AddEntriesFrom(input, _repeated_service_codec);
+ break;
+ }
+ case 58: {
+ extension_.AddEntriesFrom(input, _repeated_extension_codec);
+ break;
+ }
+ case 66: {
+ if (options_ == null) {
+ options_ = new global::Google.Protobuf.Reflection.FileOptions();
+ }
+ input.ReadMessage(options_);
+ break;
+ }
+ case 74: {
+ if (sourceCodeInfo_ == null) {
+ sourceCodeInfo_ = new global::Google.Protobuf.Reflection.SourceCodeInfo();
+ }
+ input.ReadMessage(sourceCodeInfo_);
+ break;
+ }
+ case 82:
+ case 80: {
+ publicDependency_.AddEntriesFrom(input, _repeated_publicDependency_codec);
+ break;
+ }
+ case 90:
+ case 88: {
+ weakDependency_.AddEntriesFrom(input, _repeated_weakDependency_codec);
+ break;
+ }
+ case 98: {
+ Syntax = input.ReadString();
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ /// <summary>
+ /// Describes a message type.
+ /// </summary>
+ internal sealed partial class DescriptorProto : pb::IMessage<DescriptorProto> {
+ private static readonly pb::MessageParser<DescriptorProto> _parser = new pb::MessageParser<DescriptorProto>(() => new DescriptorProto());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<DescriptorProto> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[2]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public DescriptorProto() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public DescriptorProto(DescriptorProto other) : this() {
+ name_ = other.name_;
+ field_ = other.field_.Clone();
+ extension_ = other.extension_.Clone();
+ nestedType_ = other.nestedType_.Clone();
+ enumType_ = other.enumType_.Clone();
+ extensionRange_ = other.extensionRange_.Clone();
+ oneofDecl_ = other.oneofDecl_.Clone();
+ Options = other.options_ != null ? other.Options.Clone() : null;
+ reservedRange_ = other.reservedRange_.Clone();
+ reservedName_ = other.reservedName_.Clone();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public DescriptorProto Clone() {
+ return new DescriptorProto(this);
+ }
+
+ /// <summary>Field number for the "name" field.</summary>
+ public const int NameFieldNumber = 1;
+ private string name_ = "";
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string Name {
+ get { return name_; }
+ set {
+ name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "field" field.</summary>
+ public const int FieldFieldNumber = 2;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.FieldDescriptorProto> _repeated_field_codec
+ = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> field_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto>();
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> Field {
+ get { return field_; }
+ }
+
+ /// <summary>Field number for the "extension" field.</summary>
+ public const int ExtensionFieldNumber = 6;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.FieldDescriptorProto> _repeated_extension_codec
+ = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> extension_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto>();
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> Extension {
+ get { return extension_; }
+ }
+
+ /// <summary>Field number for the "nested_type" field.</summary>
+ public const int NestedTypeFieldNumber = 3;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.DescriptorProto> _repeated_nestedType_codec
+ = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.Reflection.DescriptorProto.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto> nestedType_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto>();
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto> NestedType {
+ get { return nestedType_; }
+ }
+
+ /// <summary>Field number for the "enum_type" field.</summary>
+ public const int EnumTypeFieldNumber = 4;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.EnumDescriptorProto> _repeated_enumType_codec
+ = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto> enumType_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto>();
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto> EnumType {
+ get { return enumType_; }
+ }
+
+ /// <summary>Field number for the "extension_range" field.</summary>
+ public const int ExtensionRangeFieldNumber = 5;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange> _repeated_extensionRange_codec
+ = pb::FieldCodec.ForMessage(42, global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange> extensionRange_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange>();
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange> ExtensionRange {
+ get { return extensionRange_; }
+ }
+
+ /// <summary>Field number for the "oneof_decl" field.</summary>
+ public const int OneofDeclFieldNumber = 8;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.OneofDescriptorProto> _repeated_oneofDecl_codec
+ = pb::FieldCodec.ForMessage(66, global::Google.Protobuf.Reflection.OneofDescriptorProto.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.OneofDescriptorProto> oneofDecl_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.OneofDescriptorProto>();
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.OneofDescriptorProto> OneofDecl {
+ get { return oneofDecl_; }
+ }
+
+ /// <summary>Field number for the "options" field.</summary>
+ public const int OptionsFieldNumber = 7;
+ private global::Google.Protobuf.Reflection.MessageOptions options_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public global::Google.Protobuf.Reflection.MessageOptions Options {
+ get { return options_; }
+ set {
+ options_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "reserved_range" field.</summary>
+ public const int ReservedRangeFieldNumber = 9;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange> _repeated_reservedRange_codec
+ = pb::FieldCodec.ForMessage(74, global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange> reservedRange_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange>();
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange> ReservedRange {
+ get { return reservedRange_; }
+ }
+
+ /// <summary>Field number for the "reserved_name" field.</summary>
+ public const int ReservedNameFieldNumber = 10;
+ private static readonly pb::FieldCodec<string> _repeated_reservedName_codec
+ = pb::FieldCodec.ForString(82);
+ private readonly pbc::RepeatedField<string> reservedName_ = new pbc::RepeatedField<string>();
+ /// <summary>
+ /// Reserved field names, which may not be used by fields in the same message.
+ /// A given name may only be reserved once.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<string> ReservedName {
+ get { return reservedName_; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as DescriptorProto);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(DescriptorProto other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (Name != other.Name) return false;
+ if(!field_.Equals(other.field_)) return false;
+ if(!extension_.Equals(other.extension_)) return false;
+ if(!nestedType_.Equals(other.nestedType_)) return false;
+ if(!enumType_.Equals(other.enumType_)) return false;
+ if(!extensionRange_.Equals(other.extensionRange_)) return false;
+ if(!oneofDecl_.Equals(other.oneofDecl_)) return false;
+ if (!object.Equals(Options, other.Options)) return false;
+ if(!reservedRange_.Equals(other.reservedRange_)) return false;
+ if(!reservedName_.Equals(other.reservedName_)) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Name.Length != 0) hash ^= Name.GetHashCode();
+ hash ^= field_.GetHashCode();
+ hash ^= extension_.GetHashCode();
+ hash ^= nestedType_.GetHashCode();
+ hash ^= enumType_.GetHashCode();
+ hash ^= extensionRange_.GetHashCode();
+ hash ^= oneofDecl_.GetHashCode();
+ if (options_ != null) hash ^= Options.GetHashCode();
+ hash ^= reservedRange_.GetHashCode();
+ hash ^= reservedName_.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Name.Length != 0) {
+ output.WriteRawTag(10);
+ output.WriteString(Name);
+ }
+ field_.WriteTo(output, _repeated_field_codec);
+ nestedType_.WriteTo(output, _repeated_nestedType_codec);
+ enumType_.WriteTo(output, _repeated_enumType_codec);
+ extensionRange_.WriteTo(output, _repeated_extensionRange_codec);
+ extension_.WriteTo(output, _repeated_extension_codec);
+ if (options_ != null) {
+ output.WriteRawTag(58);
+ output.WriteMessage(Options);
+ }
+ oneofDecl_.WriteTo(output, _repeated_oneofDecl_codec);
+ reservedRange_.WriteTo(output, _repeated_reservedRange_codec);
+ reservedName_.WriteTo(output, _repeated_reservedName_codec);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (Name.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
+ }
+ size += field_.CalculateSize(_repeated_field_codec);
+ size += extension_.CalculateSize(_repeated_extension_codec);
+ size += nestedType_.CalculateSize(_repeated_nestedType_codec);
+ size += enumType_.CalculateSize(_repeated_enumType_codec);
+ size += extensionRange_.CalculateSize(_repeated_extensionRange_codec);
+ size += oneofDecl_.CalculateSize(_repeated_oneofDecl_codec);
+ if (options_ != null) {
+ size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
+ }
+ size += reservedRange_.CalculateSize(_repeated_reservedRange_codec);
+ size += reservedName_.CalculateSize(_repeated_reservedName_codec);
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(DescriptorProto other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Name.Length != 0) {
+ Name = other.Name;
+ }
+ field_.Add(other.field_);
+ extension_.Add(other.extension_);
+ nestedType_.Add(other.nestedType_);
+ enumType_.Add(other.enumType_);
+ extensionRange_.Add(other.extensionRange_);
+ oneofDecl_.Add(other.oneofDecl_);
+ if (other.options_ != null) {
+ if (options_ == null) {
+ options_ = new global::Google.Protobuf.Reflection.MessageOptions();
+ }
+ Options.MergeFrom(other.Options);
+ }
+ reservedRange_.Add(other.reservedRange_);
+ reservedName_.Add(other.reservedName_);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 10: {
+ Name = input.ReadString();
+ break;
+ }
+ case 18: {
+ field_.AddEntriesFrom(input, _repeated_field_codec);
+ break;
+ }
+ case 26: {
+ nestedType_.AddEntriesFrom(input, _repeated_nestedType_codec);
+ break;
+ }
+ case 34: {
+ enumType_.AddEntriesFrom(input, _repeated_enumType_codec);
+ break;
+ }
+ case 42: {
+ extensionRange_.AddEntriesFrom(input, _repeated_extensionRange_codec);
+ break;
+ }
+ case 50: {
+ extension_.AddEntriesFrom(input, _repeated_extension_codec);
+ break;
+ }
+ case 58: {
+ if (options_ == null) {
+ options_ = new global::Google.Protobuf.Reflection.MessageOptions();
+ }
+ input.ReadMessage(options_);
+ break;
+ }
+ case 66: {
+ oneofDecl_.AddEntriesFrom(input, _repeated_oneofDecl_codec);
+ break;
+ }
+ case 74: {
+ reservedRange_.AddEntriesFrom(input, _repeated_reservedRange_codec);
+ break;
+ }
+ case 82: {
+ reservedName_.AddEntriesFrom(input, _repeated_reservedName_codec);
+ break;
+ }
+ }
+ }
+ }
+
+ #region Nested types
+ /// <summary>Container for nested types declared in the DescriptorProto message type.</summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static partial class Types {
+ internal sealed partial class ExtensionRange : pb::IMessage<ExtensionRange> {
+ private static readonly pb::MessageParser<ExtensionRange> _parser = new pb::MessageParser<ExtensionRange>(() => new ExtensionRange());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<ExtensionRange> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProto.Descriptor.NestedTypes[0]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public ExtensionRange() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public ExtensionRange(ExtensionRange other) : this() {
+ start_ = other.start_;
+ end_ = other.end_;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public ExtensionRange Clone() {
+ return new ExtensionRange(this);
+ }
+
+ /// <summary>Field number for the "start" field.</summary>
+ public const int StartFieldNumber = 1;
+ private int start_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int Start {
+ get { return start_; }
+ set {
+ start_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "end" field.</summary>
+ public const int EndFieldNumber = 2;
+ private int end_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int End {
+ get { return end_; }
+ set {
+ end_ = value;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as ExtensionRange);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(ExtensionRange other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (Start != other.Start) return false;
+ if (End != other.End) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Start != 0) hash ^= Start.GetHashCode();
+ if (End != 0) hash ^= End.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Start != 0) {
+ output.WriteRawTag(8);
+ output.WriteInt32(Start);
+ }
+ if (End != 0) {
+ output.WriteRawTag(16);
+ output.WriteInt32(End);
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (Start != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeInt32Size(Start);
+ }
+ if (End != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeInt32Size(End);
+ }
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(ExtensionRange other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Start != 0) {
+ Start = other.Start;
+ }
+ if (other.End != 0) {
+ End = other.End;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 8: {
+ Start = input.ReadInt32();
+ break;
+ }
+ case 16: {
+ End = input.ReadInt32();
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ /// <summary>
+ /// Range of reserved tag numbers. Reserved tag numbers may not be used by
+ /// fields or extension ranges in the same message. Reserved ranges may
+ /// not overlap.
+ /// </summary>
+ internal sealed partial class ReservedRange : pb::IMessage<ReservedRange> {
+ private static readonly pb::MessageParser<ReservedRange> _parser = new pb::MessageParser<ReservedRange>(() => new ReservedRange());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<ReservedRange> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProto.Descriptor.NestedTypes[1]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public ReservedRange() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public ReservedRange(ReservedRange other) : this() {
+ start_ = other.start_;
+ end_ = other.end_;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public ReservedRange Clone() {
+ return new ReservedRange(this);
+ }
+
+ /// <summary>Field number for the "start" field.</summary>
+ public const int StartFieldNumber = 1;
+ private int start_;
+ /// <summary>
+ /// Inclusive.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int Start {
+ get { return start_; }
+ set {
+ start_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "end" field.</summary>
+ public const int EndFieldNumber = 2;
+ private int end_;
+ /// <summary>
+ /// Exclusive.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int End {
+ get { return end_; }
+ set {
+ end_ = value;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as ReservedRange);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(ReservedRange other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (Start != other.Start) return false;
+ if (End != other.End) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Start != 0) hash ^= Start.GetHashCode();
+ if (End != 0) hash ^= End.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Start != 0) {
+ output.WriteRawTag(8);
+ output.WriteInt32(Start);
+ }
+ if (End != 0) {
+ output.WriteRawTag(16);
+ output.WriteInt32(End);
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (Start != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeInt32Size(Start);
+ }
+ if (End != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeInt32Size(End);
+ }
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(ReservedRange other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Start != 0) {
+ Start = other.Start;
+ }
+ if (other.End != 0) {
+ End = other.End;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 8: {
+ Start = input.ReadInt32();
+ break;
+ }
+ case 16: {
+ End = input.ReadInt32();
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ }
+ #endregion
+
+ }
+
+ /// <summary>
+ /// Describes a field within a message.
+ /// </summary>
+ internal sealed partial class FieldDescriptorProto : pb::IMessage<FieldDescriptorProto> {
+ private static readonly pb::MessageParser<FieldDescriptorProto> _parser = new pb::MessageParser<FieldDescriptorProto>(() => new FieldDescriptorProto());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<FieldDescriptorProto> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[3]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public FieldDescriptorProto() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public FieldDescriptorProto(FieldDescriptorProto other) : this() {
+ name_ = other.name_;
+ number_ = other.number_;
+ label_ = other.label_;
+ type_ = other.type_;
+ typeName_ = other.typeName_;
+ extendee_ = other.extendee_;
+ defaultValue_ = other.defaultValue_;
+ oneofIndex_ = other.oneofIndex_;
+ jsonName_ = other.jsonName_;
+ Options = other.options_ != null ? other.Options.Clone() : null;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public FieldDescriptorProto Clone() {
+ return new FieldDescriptorProto(this);
+ }
+
+ /// <summary>Field number for the "name" field.</summary>
+ public const int NameFieldNumber = 1;
+ private string name_ = "";
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string Name {
+ get { return name_; }
+ set {
+ name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "number" field.</summary>
+ public const int NumberFieldNumber = 3;
+ private int number_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int Number {
+ get { return number_; }
+ set {
+ number_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "label" field.</summary>
+ public const int LabelFieldNumber = 4;
+ private global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label label_ = 0;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label Label {
+ get { return label_; }
+ set {
+ label_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "type" field.</summary>
+ public const int TypeFieldNumber = 5;
+ private global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type type_ = 0;
+ /// <summary>
+ /// If type_name is set, this need not be set. If both this and type_name
+ /// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type Type {
+ get { return type_; }
+ set {
+ type_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "type_name" field.</summary>
+ public const int TypeNameFieldNumber = 6;
+ private string typeName_ = "";
+ /// <summary>
+ /// For message and enum types, this is the name of the type. If the name
+ /// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
+ /// rules are used to find the type (i.e. first the nested types within this
+ /// message are searched, then within the parent, on up to the root
+ /// namespace).
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string TypeName {
+ get { return typeName_; }
+ set {
+ typeName_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "extendee" field.</summary>
+ public const int ExtendeeFieldNumber = 2;
+ private string extendee_ = "";
+ /// <summary>
+ /// For extensions, this is the name of the type being extended. It is
+ /// resolved in the same manner as type_name.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string Extendee {
+ get { return extendee_; }
+ set {
+ extendee_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "default_value" field.</summary>
+ public const int DefaultValueFieldNumber = 7;
+ private string defaultValue_ = "";
+ /// <summary>
+ /// For numeric types, contains the original text representation of the value.
+ /// For booleans, "true" or "false".
+ /// For strings, contains the default text contents (not escaped in any way).
+ /// For bytes, contains the C escaped value. All bytes >= 128 are escaped.
+ /// TODO(kenton): Base-64 encode?
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string DefaultValue {
+ get { return defaultValue_; }
+ set {
+ defaultValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "oneof_index" field.</summary>
+ public const int OneofIndexFieldNumber = 9;
+ private int oneofIndex_;
+ /// <summary>
+ /// If set, gives the index of a oneof in the containing type's oneof_decl
+ /// list. This field is a member of that oneof.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int OneofIndex {
+ get { return oneofIndex_; }
+ set {
+ oneofIndex_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "json_name" field.</summary>
+ public const int JsonNameFieldNumber = 10;
+ private string jsonName_ = "";
+ /// <summary>
+ /// JSON name of this field. The value is set by protocol compiler. If the
+ /// user has set a "json_name" option on this field, that option's value
+ /// will be used. Otherwise, it's deduced from the field's name by converting
+ /// it to camelCase.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string JsonName {
+ get { return jsonName_; }
+ set {
+ jsonName_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "options" field.</summary>
+ public const int OptionsFieldNumber = 8;
+ private global::Google.Protobuf.Reflection.FieldOptions options_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public global::Google.Protobuf.Reflection.FieldOptions Options {
+ get { return options_; }
+ set {
+ options_ = value;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as FieldDescriptorProto);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(FieldDescriptorProto other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (Name != other.Name) return false;
+ if (Number != other.Number) return false;
+ if (Label != other.Label) return false;
+ if (Type != other.Type) return false;
+ if (TypeName != other.TypeName) return false;
+ if (Extendee != other.Extendee) return false;
+ if (DefaultValue != other.DefaultValue) return false;
+ if (OneofIndex != other.OneofIndex) return false;
+ if (JsonName != other.JsonName) return false;
+ if (!object.Equals(Options, other.Options)) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Name.Length != 0) hash ^= Name.GetHashCode();
+ if (Number != 0) hash ^= Number.GetHashCode();
+ if (Label != 0) hash ^= Label.GetHashCode();
+ if (Type != 0) hash ^= Type.GetHashCode();
+ if (TypeName.Length != 0) hash ^= TypeName.GetHashCode();
+ if (Extendee.Length != 0) hash ^= Extendee.GetHashCode();
+ if (DefaultValue.Length != 0) hash ^= DefaultValue.GetHashCode();
+ if (OneofIndex != 0) hash ^= OneofIndex.GetHashCode();
+ if (JsonName.Length != 0) hash ^= JsonName.GetHashCode();
+ if (options_ != null) hash ^= Options.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Name.Length != 0) {
+ output.WriteRawTag(10);
+ output.WriteString(Name);
+ }
+ if (Extendee.Length != 0) {
+ output.WriteRawTag(18);
+ output.WriteString(Extendee);
+ }
+ if (Number != 0) {
+ output.WriteRawTag(24);
+ output.WriteInt32(Number);
+ }
+ if (Label != 0) {
+ output.WriteRawTag(32);
+ output.WriteEnum((int) Label);
+ }
+ if (Type != 0) {
+ output.WriteRawTag(40);
+ output.WriteEnum((int) Type);
+ }
+ if (TypeName.Length != 0) {
+ output.WriteRawTag(50);
+ output.WriteString(TypeName);
+ }
+ if (DefaultValue.Length != 0) {
+ output.WriteRawTag(58);
+ output.WriteString(DefaultValue);
+ }
+ if (options_ != null) {
+ output.WriteRawTag(66);
+ output.WriteMessage(Options);
+ }
+ if (OneofIndex != 0) {
+ output.WriteRawTag(72);
+ output.WriteInt32(OneofIndex);
+ }
+ if (JsonName.Length != 0) {
+ output.WriteRawTag(82);
+ output.WriteString(JsonName);
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (Name.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
+ }
+ if (Number != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeInt32Size(Number);
+ }
+ if (Label != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Label);
+ }
+ if (Type != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type);
+ }
+ if (TypeName.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(TypeName);
+ }
+ if (Extendee.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(Extendee);
+ }
+ if (DefaultValue.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(DefaultValue);
+ }
+ if (OneofIndex != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeInt32Size(OneofIndex);
+ }
+ if (JsonName.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(JsonName);
+ }
+ if (options_ != null) {
+ size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
+ }
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(FieldDescriptorProto other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Name.Length != 0) {
+ Name = other.Name;
+ }
+ if (other.Number != 0) {
+ Number = other.Number;
+ }
+ if (other.Label != 0) {
+ Label = other.Label;
+ }
+ if (other.Type != 0) {
+ Type = other.Type;
+ }
+ if (other.TypeName.Length != 0) {
+ TypeName = other.TypeName;
+ }
+ if (other.Extendee.Length != 0) {
+ Extendee = other.Extendee;
+ }
+ if (other.DefaultValue.Length != 0) {
+ DefaultValue = other.DefaultValue;
+ }
+ if (other.OneofIndex != 0) {
+ OneofIndex = other.OneofIndex;
+ }
+ if (other.JsonName.Length != 0) {
+ JsonName = other.JsonName;
+ }
+ if (other.options_ != null) {
+ if (options_ == null) {
+ options_ = new global::Google.Protobuf.Reflection.FieldOptions();
+ }
+ Options.MergeFrom(other.Options);
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 10: {
+ Name = input.ReadString();
+ break;
+ }
+ case 18: {
+ Extendee = input.ReadString();
+ break;
+ }
+ case 24: {
+ Number = input.ReadInt32();
+ break;
+ }
+ case 32: {
+ label_ = (global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label) input.ReadEnum();
+ break;
+ }
+ case 40: {
+ type_ = (global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type) input.ReadEnum();
+ break;
+ }
+ case 50: {
+ TypeName = input.ReadString();
+ break;
+ }
+ case 58: {
+ DefaultValue = input.ReadString();
+ break;
+ }
+ case 66: {
+ if (options_ == null) {
+ options_ = new global::Google.Protobuf.Reflection.FieldOptions();
+ }
+ input.ReadMessage(options_);
+ break;
+ }
+ case 72: {
+ OneofIndex = input.ReadInt32();
+ break;
+ }
+ case 82: {
+ JsonName = input.ReadString();
+ break;
+ }
+ }
+ }
+ }
+
+ #region Nested types
+ /// <summary>Container for nested types declared in the FieldDescriptorProto message type.</summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static partial class Types {
+ internal enum Type {
+ /// <summary>
+ /// 0 is reserved for errors.
+ /// Order is weird for historical reasons.
+ /// </summary>
+ [pbr::OriginalName("TYPE_DOUBLE")] Double = 1,
+ [pbr::OriginalName("TYPE_FLOAT")] Float = 2,
+ /// <summary>
+ /// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
+ /// negative values are likely.
+ /// </summary>
+ [pbr::OriginalName("TYPE_INT64")] Int64 = 3,
+ [pbr::OriginalName("TYPE_UINT64")] Uint64 = 4,
+ /// <summary>
+ /// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
+ /// negative values are likely.
+ /// </summary>
+ [pbr::OriginalName("TYPE_INT32")] Int32 = 5,
+ [pbr::OriginalName("TYPE_FIXED64")] Fixed64 = 6,
+ [pbr::OriginalName("TYPE_FIXED32")] Fixed32 = 7,
+ [pbr::OriginalName("TYPE_BOOL")] Bool = 8,
+ [pbr::OriginalName("TYPE_STRING")] String = 9,
+ /// <summary>
+ /// Tag-delimited aggregate.
+ /// </summary>
+ [pbr::OriginalName("TYPE_GROUP")] Group = 10,
+ /// <summary>
+ /// Length-delimited aggregate.
+ /// </summary>
+ [pbr::OriginalName("TYPE_MESSAGE")] Message = 11,
+ /// <summary>
+ /// New in version 2.
+ /// </summary>
+ [pbr::OriginalName("TYPE_BYTES")] Bytes = 12,
+ [pbr::OriginalName("TYPE_UINT32")] Uint32 = 13,
+ [pbr::OriginalName("TYPE_ENUM")] Enum = 14,
+ [pbr::OriginalName("TYPE_SFIXED32")] Sfixed32 = 15,
+ [pbr::OriginalName("TYPE_SFIXED64")] Sfixed64 = 16,
+ /// <summary>
+ /// Uses ZigZag encoding.
+ /// </summary>
+ [pbr::OriginalName("TYPE_SINT32")] Sint32 = 17,
+ /// <summary>
+ /// Uses ZigZag encoding.
+ /// </summary>
+ [pbr::OriginalName("TYPE_SINT64")] Sint64 = 18,
+ }
+
+ internal enum Label {
+ /// <summary>
+ /// 0 is reserved for errors
+ /// </summary>
+ [pbr::OriginalName("LABEL_OPTIONAL")] Optional = 1,
+ [pbr::OriginalName("LABEL_REQUIRED")] Required = 2,
+ /// <summary>
+ /// TODO(sanjay): Should we add LABEL_MAP?
+ /// </summary>
+ [pbr::OriginalName("LABEL_REPEATED")] Repeated = 3,
+ }
+
+ }
+ #endregion
+
+ }
+
+ /// <summary>
+ /// Describes a oneof.
+ /// </summary>
+ internal sealed partial class OneofDescriptorProto : pb::IMessage<OneofDescriptorProto> {
+ private static readonly pb::MessageParser<OneofDescriptorProto> _parser = new pb::MessageParser<OneofDescriptorProto>(() => new OneofDescriptorProto());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<OneofDescriptorProto> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[4]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public OneofDescriptorProto() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public OneofDescriptorProto(OneofDescriptorProto other) : this() {
+ name_ = other.name_;
+ Options = other.options_ != null ? other.Options.Clone() : null;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public OneofDescriptorProto Clone() {
+ return new OneofDescriptorProto(this);
+ }
+
+ /// <summary>Field number for the "name" field.</summary>
+ public const int NameFieldNumber = 1;
+ private string name_ = "";
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string Name {
+ get { return name_; }
+ set {
+ name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "options" field.</summary>
+ public const int OptionsFieldNumber = 2;
+ private global::Google.Protobuf.Reflection.OneofOptions options_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public global::Google.Protobuf.Reflection.OneofOptions Options {
+ get { return options_; }
+ set {
+ options_ = value;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as OneofDescriptorProto);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(OneofDescriptorProto other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (Name != other.Name) return false;
+ if (!object.Equals(Options, other.Options)) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Name.Length != 0) hash ^= Name.GetHashCode();
+ if (options_ != null) hash ^= Options.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Name.Length != 0) {
+ output.WriteRawTag(10);
+ output.WriteString(Name);
+ }
+ if (options_ != null) {
+ output.WriteRawTag(18);
+ output.WriteMessage(Options);
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (Name.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
+ }
+ if (options_ != null) {
+ size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
+ }
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(OneofDescriptorProto other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Name.Length != 0) {
+ Name = other.Name;
+ }
+ if (other.options_ != null) {
+ if (options_ == null) {
+ options_ = new global::Google.Protobuf.Reflection.OneofOptions();
+ }
+ Options.MergeFrom(other.Options);
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 10: {
+ Name = input.ReadString();
+ break;
+ }
+ case 18: {
+ if (options_ == null) {
+ options_ = new global::Google.Protobuf.Reflection.OneofOptions();
+ }
+ input.ReadMessage(options_);
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ /// <summary>
+ /// Describes an enum type.
+ /// </summary>
+ internal sealed partial class EnumDescriptorProto : pb::IMessage<EnumDescriptorProto> {
+ private static readonly pb::MessageParser<EnumDescriptorProto> _parser = new pb::MessageParser<EnumDescriptorProto>(() => new EnumDescriptorProto());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<EnumDescriptorProto> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[5]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public EnumDescriptorProto() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public EnumDescriptorProto(EnumDescriptorProto other) : this() {
+ name_ = other.name_;
+ value_ = other.value_.Clone();
+ Options = other.options_ != null ? other.Options.Clone() : null;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public EnumDescriptorProto Clone() {
+ return new EnumDescriptorProto(this);
+ }
+
+ /// <summary>Field number for the "name" field.</summary>
+ public const int NameFieldNumber = 1;
+ private string name_ = "";
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string Name {
+ get { return name_; }
+ set {
+ name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "value" field.</summary>
+ public const int ValueFieldNumber = 2;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.EnumValueDescriptorProto> _repeated_value_codec
+ = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.EnumValueDescriptorProto.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumValueDescriptorProto> value_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumValueDescriptorProto>();
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumValueDescriptorProto> Value {
+ get { return value_; }
+ }
+
+ /// <summary>Field number for the "options" field.</summary>
+ public const int OptionsFieldNumber = 3;
+ private global::Google.Protobuf.Reflection.EnumOptions options_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public global::Google.Protobuf.Reflection.EnumOptions Options {
+ get { return options_; }
+ set {
+ options_ = value;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as EnumDescriptorProto);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(EnumDescriptorProto other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (Name != other.Name) return false;
+ if(!value_.Equals(other.value_)) return false;
+ if (!object.Equals(Options, other.Options)) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Name.Length != 0) hash ^= Name.GetHashCode();
+ hash ^= value_.GetHashCode();
+ if (options_ != null) hash ^= Options.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Name.Length != 0) {
+ output.WriteRawTag(10);
+ output.WriteString(Name);
+ }
+ value_.WriteTo(output, _repeated_value_codec);
+ if (options_ != null) {
+ output.WriteRawTag(26);
+ output.WriteMessage(Options);
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (Name.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
+ }
+ size += value_.CalculateSize(_repeated_value_codec);
+ if (options_ != null) {
+ size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
+ }
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(EnumDescriptorProto other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Name.Length != 0) {
+ Name = other.Name;
+ }
+ value_.Add(other.value_);
+ if (other.options_ != null) {
+ if (options_ == null) {
+ options_ = new global::Google.Protobuf.Reflection.EnumOptions();
+ }
+ Options.MergeFrom(other.Options);
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 10: {
+ Name = input.ReadString();
+ break;
+ }
+ case 18: {
+ value_.AddEntriesFrom(input, _repeated_value_codec);
+ break;
+ }
+ case 26: {
+ if (options_ == null) {
+ options_ = new global::Google.Protobuf.Reflection.EnumOptions();
+ }
+ input.ReadMessage(options_);
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ /// <summary>
+ /// Describes a value within an enum.
+ /// </summary>
+ internal sealed partial class EnumValueDescriptorProto : pb::IMessage<EnumValueDescriptorProto> {
+ private static readonly pb::MessageParser<EnumValueDescriptorProto> _parser = new pb::MessageParser<EnumValueDescriptorProto>(() => new EnumValueDescriptorProto());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<EnumValueDescriptorProto> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[6]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public EnumValueDescriptorProto() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public EnumValueDescriptorProto(EnumValueDescriptorProto other) : this() {
+ name_ = other.name_;
+ number_ = other.number_;
+ Options = other.options_ != null ? other.Options.Clone() : null;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public EnumValueDescriptorProto Clone() {
+ return new EnumValueDescriptorProto(this);
+ }
+
+ /// <summary>Field number for the "name" field.</summary>
+ public const int NameFieldNumber = 1;
+ private string name_ = "";
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string Name {
+ get { return name_; }
+ set {
+ name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "number" field.</summary>
+ public const int NumberFieldNumber = 2;
+ private int number_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int Number {
+ get { return number_; }
+ set {
+ number_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "options" field.</summary>
+ public const int OptionsFieldNumber = 3;
+ private global::Google.Protobuf.Reflection.EnumValueOptions options_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public global::Google.Protobuf.Reflection.EnumValueOptions Options {
+ get { return options_; }
+ set {
+ options_ = value;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as EnumValueDescriptorProto);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(EnumValueDescriptorProto other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (Name != other.Name) return false;
+ if (Number != other.Number) return false;
+ if (!object.Equals(Options, other.Options)) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Name.Length != 0) hash ^= Name.GetHashCode();
+ if (Number != 0) hash ^= Number.GetHashCode();
+ if (options_ != null) hash ^= Options.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Name.Length != 0) {
+ output.WriteRawTag(10);
+ output.WriteString(Name);
+ }
+ if (Number != 0) {
+ output.WriteRawTag(16);
+ output.WriteInt32(Number);
+ }
+ if (options_ != null) {
+ output.WriteRawTag(26);
+ output.WriteMessage(Options);
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (Name.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
+ }
+ if (Number != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeInt32Size(Number);
+ }
+ if (options_ != null) {
+ size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
+ }
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(EnumValueDescriptorProto other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Name.Length != 0) {
+ Name = other.Name;
+ }
+ if (other.Number != 0) {
+ Number = other.Number;
+ }
+ if (other.options_ != null) {
+ if (options_ == null) {
+ options_ = new global::Google.Protobuf.Reflection.EnumValueOptions();
+ }
+ Options.MergeFrom(other.Options);
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 10: {
+ Name = input.ReadString();
+ break;
+ }
+ case 16: {
+ Number = input.ReadInt32();
+ break;
+ }
+ case 26: {
+ if (options_ == null) {
+ options_ = new global::Google.Protobuf.Reflection.EnumValueOptions();
+ }
+ input.ReadMessage(options_);
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ /// <summary>
+ /// Describes a service.
+ /// </summary>
+ internal sealed partial class ServiceDescriptorProto : pb::IMessage<ServiceDescriptorProto> {
+ private static readonly pb::MessageParser<ServiceDescriptorProto> _parser = new pb::MessageParser<ServiceDescriptorProto>(() => new ServiceDescriptorProto());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<ServiceDescriptorProto> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[7]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public ServiceDescriptorProto() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public ServiceDescriptorProto(ServiceDescriptorProto other) : this() {
+ name_ = other.name_;
+ method_ = other.method_.Clone();
+ Options = other.options_ != null ? other.Options.Clone() : null;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public ServiceDescriptorProto Clone() {
+ return new ServiceDescriptorProto(this);
+ }
+
+ /// <summary>Field number for the "name" field.</summary>
+ public const int NameFieldNumber = 1;
+ private string name_ = "";
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string Name {
+ get { return name_; }
+ set {
+ name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "method" field.</summary>
+ public const int MethodFieldNumber = 2;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.MethodDescriptorProto> _repeated_method_codec
+ = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.MethodDescriptorProto.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.MethodDescriptorProto> method_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.MethodDescriptorProto>();
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.MethodDescriptorProto> Method {
+ get { return method_; }
+ }
+
+ /// <summary>Field number for the "options" field.</summary>
+ public const int OptionsFieldNumber = 3;
+ private global::Google.Protobuf.Reflection.ServiceOptions options_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public global::Google.Protobuf.Reflection.ServiceOptions Options {
+ get { return options_; }
+ set {
+ options_ = value;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as ServiceDescriptorProto);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(ServiceDescriptorProto other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (Name != other.Name) return false;
+ if(!method_.Equals(other.method_)) return false;
+ if (!object.Equals(Options, other.Options)) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Name.Length != 0) hash ^= Name.GetHashCode();
+ hash ^= method_.GetHashCode();
+ if (options_ != null) hash ^= Options.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Name.Length != 0) {
+ output.WriteRawTag(10);
+ output.WriteString(Name);
+ }
+ method_.WriteTo(output, _repeated_method_codec);
+ if (options_ != null) {
+ output.WriteRawTag(26);
+ output.WriteMessage(Options);
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (Name.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
+ }
+ size += method_.CalculateSize(_repeated_method_codec);
+ if (options_ != null) {
+ size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
+ }
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(ServiceDescriptorProto other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Name.Length != 0) {
+ Name = other.Name;
+ }
+ method_.Add(other.method_);
+ if (other.options_ != null) {
+ if (options_ == null) {
+ options_ = new global::Google.Protobuf.Reflection.ServiceOptions();
+ }
+ Options.MergeFrom(other.Options);
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 10: {
+ Name = input.ReadString();
+ break;
+ }
+ case 18: {
+ method_.AddEntriesFrom(input, _repeated_method_codec);
+ break;
+ }
+ case 26: {
+ if (options_ == null) {
+ options_ = new global::Google.Protobuf.Reflection.ServiceOptions();
+ }
+ input.ReadMessage(options_);
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ /// <summary>
+ /// Describes a method of a service.
+ /// </summary>
+ internal sealed partial class MethodDescriptorProto : pb::IMessage<MethodDescriptorProto> {
+ private static readonly pb::MessageParser<MethodDescriptorProto> _parser = new pb::MessageParser<MethodDescriptorProto>(() => new MethodDescriptorProto());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<MethodDescriptorProto> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[8]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public MethodDescriptorProto() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public MethodDescriptorProto(MethodDescriptorProto other) : this() {
+ name_ = other.name_;
+ inputType_ = other.inputType_;
+ outputType_ = other.outputType_;
+ Options = other.options_ != null ? other.Options.Clone() : null;
+ clientStreaming_ = other.clientStreaming_;
+ serverStreaming_ = other.serverStreaming_;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public MethodDescriptorProto Clone() {
+ return new MethodDescriptorProto(this);
+ }
+
+ /// <summary>Field number for the "name" field.</summary>
+ public const int NameFieldNumber = 1;
+ private string name_ = "";
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string Name {
+ get { return name_; }
+ set {
+ name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "input_type" field.</summary>
+ public const int InputTypeFieldNumber = 2;
+ private string inputType_ = "";
+ /// <summary>
+ /// Input and output type names. These are resolved in the same way as
+ /// FieldDescriptorProto.type_name, but must refer to a message type.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string InputType {
+ get { return inputType_; }
+ set {
+ inputType_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "output_type" field.</summary>
+ public const int OutputTypeFieldNumber = 3;
+ private string outputType_ = "";
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string OutputType {
+ get { return outputType_; }
+ set {
+ outputType_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "options" field.</summary>
+ public const int OptionsFieldNumber = 4;
+ private global::Google.Protobuf.Reflection.MethodOptions options_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public global::Google.Protobuf.Reflection.MethodOptions Options {
+ get { return options_; }
+ set {
+ options_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "client_streaming" field.</summary>
+ public const int ClientStreamingFieldNumber = 5;
+ private bool clientStreaming_;
+ /// <summary>
+ /// Identifies if client streams multiple client messages
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool ClientStreaming {
+ get { return clientStreaming_; }
+ set {
+ clientStreaming_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "server_streaming" field.</summary>
+ public const int ServerStreamingFieldNumber = 6;
+ private bool serverStreaming_;
+ /// <summary>
+ /// Identifies if server streams multiple server messages
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool ServerStreaming {
+ get { return serverStreaming_; }
+ set {
+ serverStreaming_ = value;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as MethodDescriptorProto);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(MethodDescriptorProto other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (Name != other.Name) return false;
+ if (InputType != other.InputType) return false;
+ if (OutputType != other.OutputType) return false;
+ if (!object.Equals(Options, other.Options)) return false;
+ if (ClientStreaming != other.ClientStreaming) return false;
+ if (ServerStreaming != other.ServerStreaming) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Name.Length != 0) hash ^= Name.GetHashCode();
+ if (InputType.Length != 0) hash ^= InputType.GetHashCode();
+ if (OutputType.Length != 0) hash ^= OutputType.GetHashCode();
+ if (options_ != null) hash ^= Options.GetHashCode();
+ if (ClientStreaming != false) hash ^= ClientStreaming.GetHashCode();
+ if (ServerStreaming != false) hash ^= ServerStreaming.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Name.Length != 0) {
+ output.WriteRawTag(10);
+ output.WriteString(Name);
+ }
+ if (InputType.Length != 0) {
+ output.WriteRawTag(18);
+ output.WriteString(InputType);
+ }
+ if (OutputType.Length != 0) {
+ output.WriteRawTag(26);
+ output.WriteString(OutputType);
+ }
+ if (options_ != null) {
+ output.WriteRawTag(34);
+ output.WriteMessage(Options);
+ }
+ if (ClientStreaming != false) {
+ output.WriteRawTag(40);
+ output.WriteBool(ClientStreaming);
+ }
+ if (ServerStreaming != false) {
+ output.WriteRawTag(48);
+ output.WriteBool(ServerStreaming);
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (Name.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
+ }
+ if (InputType.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(InputType);
+ }
+ if (OutputType.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(OutputType);
+ }
+ if (options_ != null) {
+ size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
+ }
+ if (ClientStreaming != false) {
+ size += 1 + 1;
+ }
+ if (ServerStreaming != false) {
+ size += 1 + 1;
+ }
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(MethodDescriptorProto other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Name.Length != 0) {
+ Name = other.Name;
+ }
+ if (other.InputType.Length != 0) {
+ InputType = other.InputType;
+ }
+ if (other.OutputType.Length != 0) {
+ OutputType = other.OutputType;
+ }
+ if (other.options_ != null) {
+ if (options_ == null) {
+ options_ = new global::Google.Protobuf.Reflection.MethodOptions();
+ }
+ Options.MergeFrom(other.Options);
+ }
+ if (other.ClientStreaming != false) {
+ ClientStreaming = other.ClientStreaming;
+ }
+ if (other.ServerStreaming != false) {
+ ServerStreaming = other.ServerStreaming;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 10: {
+ Name = input.ReadString();
+ break;
+ }
+ case 18: {
+ InputType = input.ReadString();
+ break;
+ }
+ case 26: {
+ OutputType = input.ReadString();
+ break;
+ }
+ case 34: {
+ if (options_ == null) {
+ options_ = new global::Google.Protobuf.Reflection.MethodOptions();
+ }
+ input.ReadMessage(options_);
+ break;
+ }
+ case 40: {
+ ClientStreaming = input.ReadBool();
+ break;
+ }
+ case 48: {
+ ServerStreaming = input.ReadBool();
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ internal sealed partial class FileOptions : pb::IMessage<FileOptions> {
+ private static readonly pb::MessageParser<FileOptions> _parser = new pb::MessageParser<FileOptions>(() => new FileOptions());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<FileOptions> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[9]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public FileOptions() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public FileOptions(FileOptions other) : this() {
+ javaPackage_ = other.javaPackage_;
+ javaOuterClassname_ = other.javaOuterClassname_;
+ javaMultipleFiles_ = other.javaMultipleFiles_;
+ javaGenerateEqualsAndHash_ = other.javaGenerateEqualsAndHash_;
+ javaStringCheckUtf8_ = other.javaStringCheckUtf8_;
+ optimizeFor_ = other.optimizeFor_;
+ goPackage_ = other.goPackage_;
+ ccGenericServices_ = other.ccGenericServices_;
+ javaGenericServices_ = other.javaGenericServices_;
+ pyGenericServices_ = other.pyGenericServices_;
+ deprecated_ = other.deprecated_;
+ ccEnableArenas_ = other.ccEnableArenas_;
+ objcClassPrefix_ = other.objcClassPrefix_;
+ csharpNamespace_ = other.csharpNamespace_;
+ uninterpretedOption_ = other.uninterpretedOption_.Clone();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public FileOptions Clone() {
+ return new FileOptions(this);
+ }
+
+ /// <summary>Field number for the "java_package" field.</summary>
+ public const int JavaPackageFieldNumber = 1;
+ private string javaPackage_ = "";
+ /// <summary>
+ /// Sets the Java package where classes generated from this .proto will be
+ /// placed. By default, the proto package is used, but this is often
+ /// inappropriate because proto packages do not normally start with backwards
+ /// domain names.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string JavaPackage {
+ get { return javaPackage_; }
+ set {
+ javaPackage_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "java_outer_classname" field.</summary>
+ public const int JavaOuterClassnameFieldNumber = 8;
+ private string javaOuterClassname_ = "";
+ /// <summary>
+ /// If set, all the classes from the .proto file are wrapped in a single
+ /// outer class with the given name. This applies to both Proto1
+ /// (equivalent to the old "--one_java_file" option) and Proto2 (where
+ /// a .proto always translates to a single class, but you may want to
+ /// explicitly choose the class name).
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string JavaOuterClassname {
+ get { return javaOuterClassname_; }
+ set {
+ javaOuterClassname_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "java_multiple_files" field.</summary>
+ public const int JavaMultipleFilesFieldNumber = 10;
+ private bool javaMultipleFiles_;
+ /// <summary>
+ /// If set true, then the Java code generator will generate a separate .java
+ /// file for each top-level message, enum, and service defined in the .proto
+ /// file. Thus, these types will *not* be nested inside the outer class
+ /// named by java_outer_classname. However, the outer class will still be
+ /// generated to contain the file's getDescriptor() method as well as any
+ /// top-level extensions defined in the file.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool JavaMultipleFiles {
+ get { return javaMultipleFiles_; }
+ set {
+ javaMultipleFiles_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "java_generate_equals_and_hash" field.</summary>
+ public const int JavaGenerateEqualsAndHashFieldNumber = 20;
+ private bool javaGenerateEqualsAndHash_;
+ /// <summary>
+ /// If set true, then the Java code generator will generate equals() and
+ /// hashCode() methods for all messages defined in the .proto file.
+ /// This increases generated code size, potentially substantially for large
+ /// protos, which may harm a memory-constrained application.
+ /// - In the full runtime this is a speed optimization, as the
+ /// AbstractMessage base class includes reflection-based implementations of
+ /// these methods.
+ /// - In the lite runtime, setting this option changes the semantics of
+ /// equals() and hashCode() to more closely match those of the full runtime;
+ /// the generated methods compute their results based on field values rather
+ /// than object identity. (Implementations should not assume that hashcodes
+ /// will be consistent across runtimes or versions of the protocol compiler.)
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool JavaGenerateEqualsAndHash {
+ get { return javaGenerateEqualsAndHash_; }
+ set {
+ javaGenerateEqualsAndHash_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "java_string_check_utf8" field.</summary>
+ public const int JavaStringCheckUtf8FieldNumber = 27;
+ private bool javaStringCheckUtf8_;
+ /// <summary>
+ /// If set true, then the Java2 code generator will generate code that
+ /// throws an exception whenever an attempt is made to assign a non-UTF-8
+ /// byte sequence to a string field.
+ /// Message reflection will do the same.
+ /// However, an extension field still accepts non-UTF-8 byte sequences.
+ /// This option has no effect on when used with the lite runtime.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool JavaStringCheckUtf8 {
+ get { return javaStringCheckUtf8_; }
+ set {
+ javaStringCheckUtf8_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "optimize_for" field.</summary>
+ public const int OptimizeForFieldNumber = 9;
+ private global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode optimizeFor_ = 0;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode OptimizeFor {
+ get { return optimizeFor_; }
+ set {
+ optimizeFor_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "go_package" field.</summary>
+ public const int GoPackageFieldNumber = 11;
+ private string goPackage_ = "";
+ /// <summary>
+ /// Sets the Go package where structs generated from this .proto will be
+ /// placed. If omitted, the Go package will be derived from the following:
+ /// - The basename of the package import path, if provided.
+ /// - Otherwise, the package statement in the .proto file, if present.
+ /// - Otherwise, the basename of the .proto file, without extension.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string GoPackage {
+ get { return goPackage_; }
+ set {
+ goPackage_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "cc_generic_services" field.</summary>
+ public const int CcGenericServicesFieldNumber = 16;
+ private bool ccGenericServices_;
+ /// <summary>
+ /// Should generic services be generated in each language? "Generic" services
+ /// are not specific to any particular RPC system. They are generated by the
+ /// main code generators in each language (without additional plugins).
+ /// Generic services were the only kind of service generation supported by
+ /// early versions of google.protobuf.
+ ///
+ /// Generic services are now considered deprecated in favor of using plugins
+ /// that generate code specific to your particular RPC system. Therefore,
+ /// these default to false. Old code which depends on generic services should
+ /// explicitly set them to true.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool CcGenericServices {
+ get { return ccGenericServices_; }
+ set {
+ ccGenericServices_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "java_generic_services" field.</summary>
+ public const int JavaGenericServicesFieldNumber = 17;
+ private bool javaGenericServices_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool JavaGenericServices {
+ get { return javaGenericServices_; }
+ set {
+ javaGenericServices_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "py_generic_services" field.</summary>
+ public const int PyGenericServicesFieldNumber = 18;
+ private bool pyGenericServices_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool PyGenericServices {
+ get { return pyGenericServices_; }
+ set {
+ pyGenericServices_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "deprecated" field.</summary>
+ public const int DeprecatedFieldNumber = 23;
+ private bool deprecated_;
+ /// <summary>
+ /// Is this file deprecated?
+ /// Depending on the target platform, this can emit Deprecated annotations
+ /// for everything in the file, or it will be completely ignored; in the very
+ /// least, this is a formalization for deprecating files.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Deprecated {
+ get { return deprecated_; }
+ set {
+ deprecated_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "cc_enable_arenas" field.</summary>
+ public const int CcEnableArenasFieldNumber = 31;
+ private bool ccEnableArenas_;
+ /// <summary>
+ /// Enables the use of arenas for the proto messages in this file. This applies
+ /// only to generated classes for C++.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool CcEnableArenas {
+ get { return ccEnableArenas_; }
+ set {
+ ccEnableArenas_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "objc_class_prefix" field.</summary>
+ public const int ObjcClassPrefixFieldNumber = 36;
+ private string objcClassPrefix_ = "";
+ /// <summary>
+ /// Sets the objective c class prefix which is prepended to all objective c
+ /// generated classes from this .proto. There is no default.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string ObjcClassPrefix {
+ get { return objcClassPrefix_; }
+ set {
+ objcClassPrefix_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "csharp_namespace" field.</summary>
+ public const int CsharpNamespaceFieldNumber = 37;
+ private string csharpNamespace_ = "";
+ /// <summary>
+ /// Namespace for generated classes; defaults to the package.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string CsharpNamespace {
+ get { return csharpNamespace_; }
+ set {
+ csharpNamespace_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "uninterpreted_option" field.</summary>
+ public const int UninterpretedOptionFieldNumber = 999;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
+ = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
+ /// <summary>
+ /// The parser stores options it doesn't recognize here. See above.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
+ get { return uninterpretedOption_; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as FileOptions);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(FileOptions other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (JavaPackage != other.JavaPackage) return false;
+ if (JavaOuterClassname != other.JavaOuterClassname) return false;
+ if (JavaMultipleFiles != other.JavaMultipleFiles) return false;
+ if (JavaGenerateEqualsAndHash != other.JavaGenerateEqualsAndHash) return false;
+ if (JavaStringCheckUtf8 != other.JavaStringCheckUtf8) return false;
+ if (OptimizeFor != other.OptimizeFor) return false;
+ if (GoPackage != other.GoPackage) return false;
+ if (CcGenericServices != other.CcGenericServices) return false;
+ if (JavaGenericServices != other.JavaGenericServices) return false;
+ if (PyGenericServices != other.PyGenericServices) return false;
+ if (Deprecated != other.Deprecated) return false;
+ if (CcEnableArenas != other.CcEnableArenas) return false;
+ if (ObjcClassPrefix != other.ObjcClassPrefix) return false;
+ if (CsharpNamespace != other.CsharpNamespace) return false;
+ if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (JavaPackage.Length != 0) hash ^= JavaPackage.GetHashCode();
+ if (JavaOuterClassname.Length != 0) hash ^= JavaOuterClassname.GetHashCode();
+ if (JavaMultipleFiles != false) hash ^= JavaMultipleFiles.GetHashCode();
+ if (JavaGenerateEqualsAndHash != false) hash ^= JavaGenerateEqualsAndHash.GetHashCode();
+ if (JavaStringCheckUtf8 != false) hash ^= JavaStringCheckUtf8.GetHashCode();
+ if (OptimizeFor != 0) hash ^= OptimizeFor.GetHashCode();
+ if (GoPackage.Length != 0) hash ^= GoPackage.GetHashCode();
+ if (CcGenericServices != false) hash ^= CcGenericServices.GetHashCode();
+ if (JavaGenericServices != false) hash ^= JavaGenericServices.GetHashCode();
+ if (PyGenericServices != false) hash ^= PyGenericServices.GetHashCode();
+ if (Deprecated != false) hash ^= Deprecated.GetHashCode();
+ if (CcEnableArenas != false) hash ^= CcEnableArenas.GetHashCode();
+ if (ObjcClassPrefix.Length != 0) hash ^= ObjcClassPrefix.GetHashCode();
+ if (CsharpNamespace.Length != 0) hash ^= CsharpNamespace.GetHashCode();
+ hash ^= uninterpretedOption_.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (JavaPackage.Length != 0) {
+ output.WriteRawTag(10);
+ output.WriteString(JavaPackage);
+ }
+ if (JavaOuterClassname.Length != 0) {
+ output.WriteRawTag(66);
+ output.WriteString(JavaOuterClassname);
+ }
+ if (OptimizeFor != 0) {
+ output.WriteRawTag(72);
+ output.WriteEnum((int) OptimizeFor);
+ }
+ if (JavaMultipleFiles != false) {
+ output.WriteRawTag(80);
+ output.WriteBool(JavaMultipleFiles);
+ }
+ if (GoPackage.Length != 0) {
+ output.WriteRawTag(90);
+ output.WriteString(GoPackage);
+ }
+ if (CcGenericServices != false) {
+ output.WriteRawTag(128, 1);
+ output.WriteBool(CcGenericServices);
+ }
+ if (JavaGenericServices != false) {
+ output.WriteRawTag(136, 1);
+ output.WriteBool(JavaGenericServices);
+ }
+ if (PyGenericServices != false) {
+ output.WriteRawTag(144, 1);
+ output.WriteBool(PyGenericServices);
+ }
+ if (JavaGenerateEqualsAndHash != false) {
+ output.WriteRawTag(160, 1);
+ output.WriteBool(JavaGenerateEqualsAndHash);
+ }
+ if (Deprecated != false) {
+ output.WriteRawTag(184, 1);
+ output.WriteBool(Deprecated);
+ }
+ if (JavaStringCheckUtf8 != false) {
+ output.WriteRawTag(216, 1);
+ output.WriteBool(JavaStringCheckUtf8);
+ }
+ if (CcEnableArenas != false) {
+ output.WriteRawTag(248, 1);
+ output.WriteBool(CcEnableArenas);
+ }
+ if (ObjcClassPrefix.Length != 0) {
+ output.WriteRawTag(162, 2);
+ output.WriteString(ObjcClassPrefix);
+ }
+ if (CsharpNamespace.Length != 0) {
+ output.WriteRawTag(170, 2);
+ output.WriteString(CsharpNamespace);
+ }
+ uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (JavaPackage.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(JavaPackage);
+ }
+ if (JavaOuterClassname.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(JavaOuterClassname);
+ }
+ if (JavaMultipleFiles != false) {
+ size += 1 + 1;
+ }
+ if (JavaGenerateEqualsAndHash != false) {
+ size += 2 + 1;
+ }
+ if (JavaStringCheckUtf8 != false) {
+ size += 2 + 1;
+ }
+ if (OptimizeFor != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) OptimizeFor);
+ }
+ if (GoPackage.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(GoPackage);
+ }
+ if (CcGenericServices != false) {
+ size += 2 + 1;
+ }
+ if (JavaGenericServices != false) {
+ size += 2 + 1;
+ }
+ if (PyGenericServices != false) {
+ size += 2 + 1;
+ }
+ if (Deprecated != false) {
+ size += 2 + 1;
+ }
+ if (CcEnableArenas != false) {
+ size += 2 + 1;
+ }
+ if (ObjcClassPrefix.Length != 0) {
+ size += 2 + pb::CodedOutputStream.ComputeStringSize(ObjcClassPrefix);
+ }
+ if (CsharpNamespace.Length != 0) {
+ size += 2 + pb::CodedOutputStream.ComputeStringSize(CsharpNamespace);
+ }
+ size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(FileOptions other) {
+ if (other == null) {
+ return;
+ }
+ if (other.JavaPackage.Length != 0) {
+ JavaPackage = other.JavaPackage;
+ }
+ if (other.JavaOuterClassname.Length != 0) {
+ JavaOuterClassname = other.JavaOuterClassname;
+ }
+ if (other.JavaMultipleFiles != false) {
+ JavaMultipleFiles = other.JavaMultipleFiles;
+ }
+ if (other.JavaGenerateEqualsAndHash != false) {
+ JavaGenerateEqualsAndHash = other.JavaGenerateEqualsAndHash;
+ }
+ if (other.JavaStringCheckUtf8 != false) {
+ JavaStringCheckUtf8 = other.JavaStringCheckUtf8;
+ }
+ if (other.OptimizeFor != 0) {
+ OptimizeFor = other.OptimizeFor;
+ }
+ if (other.GoPackage.Length != 0) {
+ GoPackage = other.GoPackage;
+ }
+ if (other.CcGenericServices != false) {
+ CcGenericServices = other.CcGenericServices;
+ }
+ if (other.JavaGenericServices != false) {
+ JavaGenericServices = other.JavaGenericServices;
+ }
+ if (other.PyGenericServices != false) {
+ PyGenericServices = other.PyGenericServices;
+ }
+ if (other.Deprecated != false) {
+ Deprecated = other.Deprecated;
+ }
+ if (other.CcEnableArenas != false) {
+ CcEnableArenas = other.CcEnableArenas;
+ }
+ if (other.ObjcClassPrefix.Length != 0) {
+ ObjcClassPrefix = other.ObjcClassPrefix;
+ }
+ if (other.CsharpNamespace.Length != 0) {
+ CsharpNamespace = other.CsharpNamespace;
+ }
+ uninterpretedOption_.Add(other.uninterpretedOption_);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 10: {
+ JavaPackage = input.ReadString();
+ break;
+ }
+ case 66: {
+ JavaOuterClassname = input.ReadString();
+ break;
+ }
+ case 72: {
+ optimizeFor_ = (global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) input.ReadEnum();
+ break;
+ }
+ case 80: {
+ JavaMultipleFiles = input.ReadBool();
+ break;
+ }
+ case 90: {
+ GoPackage = input.ReadString();
+ break;
+ }
+ case 128: {
+ CcGenericServices = input.ReadBool();
+ break;
+ }
+ case 136: {
+ JavaGenericServices = input.ReadBool();
+ break;
+ }
+ case 144: {
+ PyGenericServices = input.ReadBool();
+ break;
+ }
+ case 160: {
+ JavaGenerateEqualsAndHash = input.ReadBool();
+ break;
+ }
+ case 184: {
+ Deprecated = input.ReadBool();
+ break;
+ }
+ case 216: {
+ JavaStringCheckUtf8 = input.ReadBool();
+ break;
+ }
+ case 248: {
+ CcEnableArenas = input.ReadBool();
+ break;
+ }
+ case 290: {
+ ObjcClassPrefix = input.ReadString();
+ break;
+ }
+ case 298: {
+ CsharpNamespace = input.ReadString();
+ break;
+ }
+ case 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ }
+
+ #region Nested types
+ /// <summary>Container for nested types declared in the FileOptions message type.</summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static partial class Types {
+ /// <summary>
+ /// Generated classes can be optimized for speed or code size.
+ /// </summary>
+ internal enum OptimizeMode {
+ /// <summary>
+ /// Generate complete code for parsing, serialization,
+ /// </summary>
+ [pbr::OriginalName("SPEED")] Speed = 1,
+ /// <summary>
+ /// etc.
+ /// </summary>
+ [pbr::OriginalName("CODE_SIZE")] CodeSize = 2,
+ /// <summary>
+ /// Generate code using MessageLite and the lite runtime.
+ /// </summary>
+ [pbr::OriginalName("LITE_RUNTIME")] LiteRuntime = 3,
+ }
+
+ }
+ #endregion
+
+ }
+
+ internal sealed partial class MessageOptions : pb::IMessage<MessageOptions> {
+ private static readonly pb::MessageParser<MessageOptions> _parser = new pb::MessageParser<MessageOptions>(() => new MessageOptions());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<MessageOptions> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[10]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public MessageOptions() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public MessageOptions(MessageOptions other) : this() {
+ messageSetWireFormat_ = other.messageSetWireFormat_;
+ noStandardDescriptorAccessor_ = other.noStandardDescriptorAccessor_;
+ deprecated_ = other.deprecated_;
+ mapEntry_ = other.mapEntry_;
+ uninterpretedOption_ = other.uninterpretedOption_.Clone();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public MessageOptions Clone() {
+ return new MessageOptions(this);
+ }
+
+ /// <summary>Field number for the "message_set_wire_format" field.</summary>
+ public const int MessageSetWireFormatFieldNumber = 1;
+ private bool messageSetWireFormat_;
+ /// <summary>
+ /// Set true to use the old proto1 MessageSet wire format for extensions.
+ /// This is provided for backwards-compatibility with the MessageSet wire
+ /// format. You should not use this for any other reason: It's less
+ /// efficient, has fewer features, and is more complicated.
+ ///
+ /// The message must be defined exactly as follows:
+ /// message Foo {
+ /// option message_set_wire_format = true;
+ /// extensions 4 to max;
+ /// }
+ /// Note that the message cannot have any defined fields; MessageSets only
+ /// have extensions.
+ ///
+ /// All extensions of your type must be singular messages; e.g. they cannot
+ /// be int32s, enums, or repeated messages.
+ ///
+ /// Because this is an option, the above two restrictions are not enforced by
+ /// the protocol compiler.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool MessageSetWireFormat {
+ get { return messageSetWireFormat_; }
+ set {
+ messageSetWireFormat_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "no_standard_descriptor_accessor" field.</summary>
+ public const int NoStandardDescriptorAccessorFieldNumber = 2;
+ private bool noStandardDescriptorAccessor_;
+ /// <summary>
+ /// Disables the generation of the standard "descriptor()" accessor, which can
+ /// conflict with a field of the same name. This is meant to make migration
+ /// from proto1 easier; new code should avoid fields named "descriptor".
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool NoStandardDescriptorAccessor {
+ get { return noStandardDescriptorAccessor_; }
+ set {
+ noStandardDescriptorAccessor_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "deprecated" field.</summary>
+ public const int DeprecatedFieldNumber = 3;
+ private bool deprecated_;
+ /// <summary>
+ /// Is this message deprecated?
+ /// Depending on the target platform, this can emit Deprecated annotations
+ /// for the message, or it will be completely ignored; in the very least,
+ /// this is a formalization for deprecating messages.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Deprecated {
+ get { return deprecated_; }
+ set {
+ deprecated_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "map_entry" field.</summary>
+ public const int MapEntryFieldNumber = 7;
+ private bool mapEntry_;
+ /// <summary>
+ /// Whether the message is an automatically generated map entry type for the
+ /// maps field.
+ ///
+ /// For maps fields:
+ /// map&lt;KeyType, ValueType> map_field = 1;
+ /// The parsed descriptor looks like:
+ /// message MapFieldEntry {
+ /// option map_entry = true;
+ /// optional KeyType key = 1;
+ /// optional ValueType value = 2;
+ /// }
+ /// repeated MapFieldEntry map_field = 1;
+ ///
+ /// Implementations may choose not to generate the map_entry=true message, but
+ /// use a native map in the target language to hold the keys and values.
+ /// The reflection APIs in such implementions still need to work as
+ /// if the field is a repeated message field.
+ ///
+ /// NOTE: Do not set the option in .proto files. Always use the maps syntax
+ /// instead. The option should only be implicitly set by the proto compiler
+ /// parser.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool MapEntry {
+ get { return mapEntry_; }
+ set {
+ mapEntry_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "uninterpreted_option" field.</summary>
+ public const int UninterpretedOptionFieldNumber = 999;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
+ = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
+ /// <summary>
+ /// The parser stores options it doesn't recognize here. See above.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
+ get { return uninterpretedOption_; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as MessageOptions);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(MessageOptions other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (MessageSetWireFormat != other.MessageSetWireFormat) return false;
+ if (NoStandardDescriptorAccessor != other.NoStandardDescriptorAccessor) return false;
+ if (Deprecated != other.Deprecated) return false;
+ if (MapEntry != other.MapEntry) return false;
+ if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (MessageSetWireFormat != false) hash ^= MessageSetWireFormat.GetHashCode();
+ if (NoStandardDescriptorAccessor != false) hash ^= NoStandardDescriptorAccessor.GetHashCode();
+ if (Deprecated != false) hash ^= Deprecated.GetHashCode();
+ if (MapEntry != false) hash ^= MapEntry.GetHashCode();
+ hash ^= uninterpretedOption_.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (MessageSetWireFormat != false) {
+ output.WriteRawTag(8);
+ output.WriteBool(MessageSetWireFormat);
+ }
+ if (NoStandardDescriptorAccessor != false) {
+ output.WriteRawTag(16);
+ output.WriteBool(NoStandardDescriptorAccessor);
+ }
+ if (Deprecated != false) {
+ output.WriteRawTag(24);
+ output.WriteBool(Deprecated);
+ }
+ if (MapEntry != false) {
+ output.WriteRawTag(56);
+ output.WriteBool(MapEntry);
+ }
+ uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (MessageSetWireFormat != false) {
+ size += 1 + 1;
+ }
+ if (NoStandardDescriptorAccessor != false) {
+ size += 1 + 1;
+ }
+ if (Deprecated != false) {
+ size += 1 + 1;
+ }
+ if (MapEntry != false) {
+ size += 1 + 1;
+ }
+ size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(MessageOptions other) {
+ if (other == null) {
+ return;
+ }
+ if (other.MessageSetWireFormat != false) {
+ MessageSetWireFormat = other.MessageSetWireFormat;
+ }
+ if (other.NoStandardDescriptorAccessor != false) {
+ NoStandardDescriptorAccessor = other.NoStandardDescriptorAccessor;
+ }
+ if (other.Deprecated != false) {
+ Deprecated = other.Deprecated;
+ }
+ if (other.MapEntry != false) {
+ MapEntry = other.MapEntry;
+ }
+ uninterpretedOption_.Add(other.uninterpretedOption_);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 8: {
+ MessageSetWireFormat = input.ReadBool();
+ break;
+ }
+ case 16: {
+ NoStandardDescriptorAccessor = input.ReadBool();
+ break;
+ }
+ case 24: {
+ Deprecated = input.ReadBool();
+ break;
+ }
+ case 56: {
+ MapEntry = input.ReadBool();
+ break;
+ }
+ case 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ internal sealed partial class FieldOptions : pb::IMessage<FieldOptions> {
+ private static readonly pb::MessageParser<FieldOptions> _parser = new pb::MessageParser<FieldOptions>(() => new FieldOptions());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<FieldOptions> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[11]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public FieldOptions() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public FieldOptions(FieldOptions other) : this() {
+ ctype_ = other.ctype_;
+ packed_ = other.packed_;
+ jstype_ = other.jstype_;
+ lazy_ = other.lazy_;
+ deprecated_ = other.deprecated_;
+ weak_ = other.weak_;
+ uninterpretedOption_ = other.uninterpretedOption_.Clone();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public FieldOptions Clone() {
+ return new FieldOptions(this);
+ }
+
+ /// <summary>Field number for the "ctype" field.</summary>
+ public const int CtypeFieldNumber = 1;
+ private global::Google.Protobuf.Reflection.FieldOptions.Types.CType ctype_ = 0;
+ /// <summary>
+ /// The ctype option instructs the C++ code generator to use a different
+ /// representation of the field than it normally would. See the specific
+ /// options below. This option is not yet implemented in the open source
+ /// release -- sorry, we'll try to include it in a future version!
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public global::Google.Protobuf.Reflection.FieldOptions.Types.CType Ctype {
+ get { return ctype_; }
+ set {
+ ctype_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "packed" field.</summary>
+ public const int PackedFieldNumber = 2;
+ private bool packed_;
+ /// <summary>
+ /// The packed option can be enabled for repeated primitive fields to enable
+ /// a more efficient representation on the wire. Rather than repeatedly
+ /// writing the tag and type for each element, the entire array is encoded as
+ /// a single length-delimited blob. In proto3, only explicit setting it to
+ /// false will avoid using packed encoding.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Packed {
+ get { return packed_; }
+ set {
+ packed_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "jstype" field.</summary>
+ public const int JstypeFieldNumber = 6;
+ private global::Google.Protobuf.Reflection.FieldOptions.Types.JSType jstype_ = 0;
+ /// <summary>
+ /// The jstype option determines the JavaScript type used for values of the
+ /// field. The option is permitted only for 64 bit integral and fixed types
+ /// (int64, uint64, sint64, fixed64, sfixed64). By default these types are
+ /// represented as JavaScript strings. This avoids loss of precision that can
+ /// happen when a large value is converted to a floating point JavaScript
+ /// numbers. Specifying JS_NUMBER for the jstype causes the generated
+ /// JavaScript code to use the JavaScript "number" type instead of strings.
+ /// This option is an enum to permit additional types to be added,
+ /// e.g. goog.math.Integer.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public global::Google.Protobuf.Reflection.FieldOptions.Types.JSType Jstype {
+ get { return jstype_; }
+ set {
+ jstype_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "lazy" field.</summary>
+ public const int LazyFieldNumber = 5;
+ private bool lazy_;
+ /// <summary>
+ /// Should this field be parsed lazily? Lazy applies only to message-type
+ /// fields. It means that when the outer message is initially parsed, the
+ /// inner message's contents will not be parsed but instead stored in encoded
+ /// form. The inner message will actually be parsed when it is first accessed.
+ ///
+ /// This is only a hint. Implementations are free to choose whether to use
+ /// eager or lazy parsing regardless of the value of this option. However,
+ /// setting this option true suggests that the protocol author believes that
+ /// using lazy parsing on this field is worth the additional bookkeeping
+ /// overhead typically needed to implement it.
+ ///
+ /// This option does not affect the public interface of any generated code;
+ /// all method signatures remain the same. Furthermore, thread-safety of the
+ /// interface is not affected by this option; const methods remain safe to
+ /// call from multiple threads concurrently, while non-const methods continue
+ /// to require exclusive access.
+ ///
+ /// Note that implementations may choose not to check required fields within
+ /// a lazy sub-message. That is, calling IsInitialized() on the outher message
+ /// may return true even if the inner message has missing required fields.
+ /// This is necessary because otherwise the inner message would have to be
+ /// parsed in order to perform the check, defeating the purpose of lazy
+ /// parsing. An implementation which chooses not to check required fields
+ /// must be consistent about it. That is, for any particular sub-message, the
+ /// implementation must either *always* check its required fields, or *never*
+ /// check its required fields, regardless of whether or not the message has
+ /// been parsed.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Lazy {
+ get { return lazy_; }
+ set {
+ lazy_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "deprecated" field.</summary>
+ public const int DeprecatedFieldNumber = 3;
+ private bool deprecated_;
+ /// <summary>
+ /// Is this field deprecated?
+ /// Depending on the target platform, this can emit Deprecated annotations
+ /// for accessors, or it will be completely ignored; in the very least, this
+ /// is a formalization for deprecating fields.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Deprecated {
+ get { return deprecated_; }
+ set {
+ deprecated_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "weak" field.</summary>
+ public const int WeakFieldNumber = 10;
+ private bool weak_;
+ /// <summary>
+ /// For Google-internal migration only. Do not use.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Weak {
+ get { return weak_; }
+ set {
+ weak_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "uninterpreted_option" field.</summary>
+ public const int UninterpretedOptionFieldNumber = 999;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
+ = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
+ /// <summary>
+ /// The parser stores options it doesn't recognize here. See above.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
+ get { return uninterpretedOption_; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as FieldOptions);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(FieldOptions other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (Ctype != other.Ctype) return false;
+ if (Packed != other.Packed) return false;
+ if (Jstype != other.Jstype) return false;
+ if (Lazy != other.Lazy) return false;
+ if (Deprecated != other.Deprecated) return false;
+ if (Weak != other.Weak) return false;
+ if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Ctype != 0) hash ^= Ctype.GetHashCode();
+ if (Packed != false) hash ^= Packed.GetHashCode();
+ if (Jstype != 0) hash ^= Jstype.GetHashCode();
+ if (Lazy != false) hash ^= Lazy.GetHashCode();
+ if (Deprecated != false) hash ^= Deprecated.GetHashCode();
+ if (Weak != false) hash ^= Weak.GetHashCode();
+ hash ^= uninterpretedOption_.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Ctype != 0) {
+ output.WriteRawTag(8);
+ output.WriteEnum((int) Ctype);
+ }
+ if (Packed != false) {
+ output.WriteRawTag(16);
+ output.WriteBool(Packed);
+ }
+ if (Deprecated != false) {
+ output.WriteRawTag(24);
+ output.WriteBool(Deprecated);
+ }
+ if (Lazy != false) {
+ output.WriteRawTag(40);
+ output.WriteBool(Lazy);
+ }
+ if (Jstype != 0) {
+ output.WriteRawTag(48);
+ output.WriteEnum((int) Jstype);
+ }
+ if (Weak != false) {
+ output.WriteRawTag(80);
+ output.WriteBool(Weak);
+ }
+ uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (Ctype != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Ctype);
+ }
+ if (Packed != false) {
+ size += 1 + 1;
+ }
+ if (Jstype != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Jstype);
+ }
+ if (Lazy != false) {
+ size += 1 + 1;
+ }
+ if (Deprecated != false) {
+ size += 1 + 1;
+ }
+ if (Weak != false) {
+ size += 1 + 1;
+ }
+ size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(FieldOptions other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Ctype != 0) {
+ Ctype = other.Ctype;
+ }
+ if (other.Packed != false) {
+ Packed = other.Packed;
+ }
+ if (other.Jstype != 0) {
+ Jstype = other.Jstype;
+ }
+ if (other.Lazy != false) {
+ Lazy = other.Lazy;
+ }
+ if (other.Deprecated != false) {
+ Deprecated = other.Deprecated;
+ }
+ if (other.Weak != false) {
+ Weak = other.Weak;
+ }
+ uninterpretedOption_.Add(other.uninterpretedOption_);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 8: {
+ ctype_ = (global::Google.Protobuf.Reflection.FieldOptions.Types.CType) input.ReadEnum();
+ break;
+ }
+ case 16: {
+ Packed = input.ReadBool();
+ break;
+ }
+ case 24: {
+ Deprecated = input.ReadBool();
+ break;
+ }
+ case 40: {
+ Lazy = input.ReadBool();
+ break;
+ }
+ case 48: {
+ jstype_ = (global::Google.Protobuf.Reflection.FieldOptions.Types.JSType) input.ReadEnum();
+ break;
+ }
+ case 80: {
+ Weak = input.ReadBool();
+ break;
+ }
+ case 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ }
+
+ #region Nested types
+ /// <summary>Container for nested types declared in the FieldOptions message type.</summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static partial class Types {
+ internal enum CType {
+ /// <summary>
+ /// Default mode.
+ /// </summary>
+ [pbr::OriginalName("STRING")] String = 0,
+ [pbr::OriginalName("CORD")] Cord = 1,
+ [pbr::OriginalName("STRING_PIECE")] StringPiece = 2,
+ }
+
+ internal enum JSType {
+ /// <summary>
+ /// Use the default type.
+ /// </summary>
+ [pbr::OriginalName("JS_NORMAL")] JsNormal = 0,
+ /// <summary>
+ /// Use JavaScript strings.
+ /// </summary>
+ [pbr::OriginalName("JS_STRING")] JsString = 1,
+ /// <summary>
+ /// Use JavaScript numbers.
+ /// </summary>
+ [pbr::OriginalName("JS_NUMBER")] JsNumber = 2,
+ }
+
+ }
+ #endregion
+
+ }
+
+ internal sealed partial class OneofOptions : pb::IMessage<OneofOptions> {
+ private static readonly pb::MessageParser<OneofOptions> _parser = new pb::MessageParser<OneofOptions>(() => new OneofOptions());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<OneofOptions> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[12]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public OneofOptions() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public OneofOptions(OneofOptions other) : this() {
+ uninterpretedOption_ = other.uninterpretedOption_.Clone();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public OneofOptions Clone() {
+ return new OneofOptions(this);
+ }
+
+ /// <summary>Field number for the "uninterpreted_option" field.</summary>
+ public const int UninterpretedOptionFieldNumber = 999;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
+ = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
+ /// <summary>
+ /// The parser stores options it doesn't recognize here. See above.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
+ get { return uninterpretedOption_; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as OneofOptions);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(OneofOptions other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ hash ^= uninterpretedOption_.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(OneofOptions other) {
+ if (other == null) {
+ return;
+ }
+ uninterpretedOption_.Add(other.uninterpretedOption_);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ internal sealed partial class EnumOptions : pb::IMessage<EnumOptions> {
+ private static readonly pb::MessageParser<EnumOptions> _parser = new pb::MessageParser<EnumOptions>(() => new EnumOptions());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<EnumOptions> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[13]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public EnumOptions() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public EnumOptions(EnumOptions other) : this() {
+ allowAlias_ = other.allowAlias_;
+ deprecated_ = other.deprecated_;
+ uninterpretedOption_ = other.uninterpretedOption_.Clone();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public EnumOptions Clone() {
+ return new EnumOptions(this);
+ }
+
+ /// <summary>Field number for the "allow_alias" field.</summary>
+ public const int AllowAliasFieldNumber = 2;
+ private bool allowAlias_;
+ /// <summary>
+ /// Set this option to true to allow mapping different tag names to the same
+ /// value.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool AllowAlias {
+ get { return allowAlias_; }
+ set {
+ allowAlias_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "deprecated" field.</summary>
+ public const int DeprecatedFieldNumber = 3;
+ private bool deprecated_;
+ /// <summary>
+ /// Is this enum deprecated?
+ /// Depending on the target platform, this can emit Deprecated annotations
+ /// for the enum, or it will be completely ignored; in the very least, this
+ /// is a formalization for deprecating enums.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Deprecated {
+ get { return deprecated_; }
+ set {
+ deprecated_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "uninterpreted_option" field.</summary>
+ public const int UninterpretedOptionFieldNumber = 999;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
+ = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
+ /// <summary>
+ /// The parser stores options it doesn't recognize here. See above.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
+ get { return uninterpretedOption_; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as EnumOptions);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(EnumOptions other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (AllowAlias != other.AllowAlias) return false;
+ if (Deprecated != other.Deprecated) return false;
+ if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (AllowAlias != false) hash ^= AllowAlias.GetHashCode();
+ if (Deprecated != false) hash ^= Deprecated.GetHashCode();
+ hash ^= uninterpretedOption_.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (AllowAlias != false) {
+ output.WriteRawTag(16);
+ output.WriteBool(AllowAlias);
+ }
+ if (Deprecated != false) {
+ output.WriteRawTag(24);
+ output.WriteBool(Deprecated);
+ }
+ uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (AllowAlias != false) {
+ size += 1 + 1;
+ }
+ if (Deprecated != false) {
+ size += 1 + 1;
+ }
+ size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(EnumOptions other) {
+ if (other == null) {
+ return;
+ }
+ if (other.AllowAlias != false) {
+ AllowAlias = other.AllowAlias;
+ }
+ if (other.Deprecated != false) {
+ Deprecated = other.Deprecated;
+ }
+ uninterpretedOption_.Add(other.uninterpretedOption_);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 16: {
+ AllowAlias = input.ReadBool();
+ break;
+ }
+ case 24: {
+ Deprecated = input.ReadBool();
+ break;
+ }
+ case 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ internal sealed partial class EnumValueOptions : pb::IMessage<EnumValueOptions> {
+ private static readonly pb::MessageParser<EnumValueOptions> _parser = new pb::MessageParser<EnumValueOptions>(() => new EnumValueOptions());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<EnumValueOptions> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[14]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public EnumValueOptions() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public EnumValueOptions(EnumValueOptions other) : this() {
+ deprecated_ = other.deprecated_;
+ uninterpretedOption_ = other.uninterpretedOption_.Clone();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public EnumValueOptions Clone() {
+ return new EnumValueOptions(this);
+ }
+
+ /// <summary>Field number for the "deprecated" field.</summary>
+ public const int DeprecatedFieldNumber = 1;
+ private bool deprecated_;
+ /// <summary>
+ /// Is this enum value deprecated?
+ /// Depending on the target platform, this can emit Deprecated annotations
+ /// for the enum value, or it will be completely ignored; in the very least,
+ /// this is a formalization for deprecating enum values.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Deprecated {
+ get { return deprecated_; }
+ set {
+ deprecated_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "uninterpreted_option" field.</summary>
+ public const int UninterpretedOptionFieldNumber = 999;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
+ = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
+ /// <summary>
+ /// The parser stores options it doesn't recognize here. See above.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
+ get { return uninterpretedOption_; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as EnumValueOptions);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(EnumValueOptions other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (Deprecated != other.Deprecated) return false;
+ if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Deprecated != false) hash ^= Deprecated.GetHashCode();
+ hash ^= uninterpretedOption_.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Deprecated != false) {
+ output.WriteRawTag(8);
+ output.WriteBool(Deprecated);
+ }
+ uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (Deprecated != false) {
+ size += 1 + 1;
+ }
+ size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(EnumValueOptions other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Deprecated != false) {
+ Deprecated = other.Deprecated;
+ }
+ uninterpretedOption_.Add(other.uninterpretedOption_);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 8: {
+ Deprecated = input.ReadBool();
+ break;
+ }
+ case 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ internal sealed partial class ServiceOptions : pb::IMessage<ServiceOptions> {
+ private static readonly pb::MessageParser<ServiceOptions> _parser = new pb::MessageParser<ServiceOptions>(() => new ServiceOptions());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<ServiceOptions> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[15]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public ServiceOptions() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public ServiceOptions(ServiceOptions other) : this() {
+ deprecated_ = other.deprecated_;
+ uninterpretedOption_ = other.uninterpretedOption_.Clone();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public ServiceOptions Clone() {
+ return new ServiceOptions(this);
+ }
+
+ /// <summary>Field number for the "deprecated" field.</summary>
+ public const int DeprecatedFieldNumber = 33;
+ private bool deprecated_;
+ /// <summary>
+ /// Is this service deprecated?
+ /// Depending on the target platform, this can emit Deprecated annotations
+ /// for the service, or it will be completely ignored; in the very least,
+ /// this is a formalization for deprecating services.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Deprecated {
+ get { return deprecated_; }
+ set {
+ deprecated_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "uninterpreted_option" field.</summary>
+ public const int UninterpretedOptionFieldNumber = 999;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
+ = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
+ /// <summary>
+ /// The parser stores options it doesn't recognize here. See above.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
+ get { return uninterpretedOption_; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as ServiceOptions);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(ServiceOptions other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (Deprecated != other.Deprecated) return false;
+ if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Deprecated != false) hash ^= Deprecated.GetHashCode();
+ hash ^= uninterpretedOption_.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Deprecated != false) {
+ output.WriteRawTag(136, 2);
+ output.WriteBool(Deprecated);
+ }
+ uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (Deprecated != false) {
+ size += 2 + 1;
+ }
+ size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(ServiceOptions other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Deprecated != false) {
+ Deprecated = other.Deprecated;
+ }
+ uninterpretedOption_.Add(other.uninterpretedOption_);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 264: {
+ Deprecated = input.ReadBool();
+ break;
+ }
+ case 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ internal sealed partial class MethodOptions : pb::IMessage<MethodOptions> {
+ private static readonly pb::MessageParser<MethodOptions> _parser = new pb::MessageParser<MethodOptions>(() => new MethodOptions());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<MethodOptions> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[16]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public MethodOptions() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public MethodOptions(MethodOptions other) : this() {
+ deprecated_ = other.deprecated_;
+ uninterpretedOption_ = other.uninterpretedOption_.Clone();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public MethodOptions Clone() {
+ return new MethodOptions(this);
+ }
+
+ /// <summary>Field number for the "deprecated" field.</summary>
+ public const int DeprecatedFieldNumber = 33;
+ private bool deprecated_;
+ /// <summary>
+ /// Is this method deprecated?
+ /// Depending on the target platform, this can emit Deprecated annotations
+ /// for the method, or it will be completely ignored; in the very least,
+ /// this is a formalization for deprecating methods.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Deprecated {
+ get { return deprecated_; }
+ set {
+ deprecated_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "uninterpreted_option" field.</summary>
+ public const int UninterpretedOptionFieldNumber = 999;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption> _repeated_uninterpretedOption_codec
+ = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> uninterpretedOption_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption>();
+ /// <summary>
+ /// The parser stores options it doesn't recognize here. See above.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
+ get { return uninterpretedOption_; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as MethodOptions);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(MethodOptions other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (Deprecated != other.Deprecated) return false;
+ if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Deprecated != false) hash ^= Deprecated.GetHashCode();
+ hash ^= uninterpretedOption_.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Deprecated != false) {
+ output.WriteRawTag(136, 2);
+ output.WriteBool(Deprecated);
+ }
+ uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (Deprecated != false) {
+ size += 2 + 1;
+ }
+ size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(MethodOptions other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Deprecated != false) {
+ Deprecated = other.Deprecated;
+ }
+ uninterpretedOption_.Add(other.uninterpretedOption_);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 264: {
+ Deprecated = input.ReadBool();
+ break;
+ }
+ case 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ /// <summary>
+ /// A message representing a option the parser does not recognize. This only
+ /// appears in options protos created by the compiler::Parser class.
+ /// DescriptorPool resolves these when building Descriptor objects. Therefore,
+ /// options protos in descriptor objects (e.g. returned by Descriptor::options(),
+ /// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
+ /// in them.
+ /// </summary>
+ internal sealed partial class UninterpretedOption : pb::IMessage<UninterpretedOption> {
+ private static readonly pb::MessageParser<UninterpretedOption> _parser = new pb::MessageParser<UninterpretedOption>(() => new UninterpretedOption());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<UninterpretedOption> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[17]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public UninterpretedOption() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public UninterpretedOption(UninterpretedOption other) : this() {
+ name_ = other.name_.Clone();
+ identifierValue_ = other.identifierValue_;
+ positiveIntValue_ = other.positiveIntValue_;
+ negativeIntValue_ = other.negativeIntValue_;
+ doubleValue_ = other.doubleValue_;
+ stringValue_ = other.stringValue_;
+ aggregateValue_ = other.aggregateValue_;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public UninterpretedOption Clone() {
+ return new UninterpretedOption(this);
+ }
+
+ /// <summary>Field number for the "name" field.</summary>
+ public const int NameFieldNumber = 2;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart> _repeated_name_codec
+ = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart> name_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart>();
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart> Name {
+ get { return name_; }
+ }
+
+ /// <summary>Field number for the "identifier_value" field.</summary>
+ public const int IdentifierValueFieldNumber = 3;
+ private string identifierValue_ = "";
+ /// <summary>
+ /// The value of the uninterpreted option, in whatever type the tokenizer
+ /// identified it as during parsing. Exactly one of these should be set.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string IdentifierValue {
+ get { return identifierValue_; }
+ set {
+ identifierValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "positive_int_value" field.</summary>
+ public const int PositiveIntValueFieldNumber = 4;
+ private ulong positiveIntValue_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public ulong PositiveIntValue {
+ get { return positiveIntValue_; }
+ set {
+ positiveIntValue_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "negative_int_value" field.</summary>
+ public const int NegativeIntValueFieldNumber = 5;
+ private long negativeIntValue_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public long NegativeIntValue {
+ get { return negativeIntValue_; }
+ set {
+ negativeIntValue_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "double_value" field.</summary>
+ public const int DoubleValueFieldNumber = 6;
+ private double doubleValue_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public double DoubleValue {
+ get { return doubleValue_; }
+ set {
+ doubleValue_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "string_value" field.</summary>
+ public const int StringValueFieldNumber = 7;
+ private pb::ByteString stringValue_ = pb::ByteString.Empty;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pb::ByteString StringValue {
+ get { return stringValue_; }
+ set {
+ stringValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "aggregate_value" field.</summary>
+ public const int AggregateValueFieldNumber = 8;
+ private string aggregateValue_ = "";
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string AggregateValue {
+ get { return aggregateValue_; }
+ set {
+ aggregateValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as UninterpretedOption);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(UninterpretedOption other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if(!name_.Equals(other.name_)) return false;
+ if (IdentifierValue != other.IdentifierValue) return false;
+ if (PositiveIntValue != other.PositiveIntValue) return false;
+ if (NegativeIntValue != other.NegativeIntValue) return false;
+ if (DoubleValue != other.DoubleValue) return false;
+ if (StringValue != other.StringValue) return false;
+ if (AggregateValue != other.AggregateValue) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ hash ^= name_.GetHashCode();
+ if (IdentifierValue.Length != 0) hash ^= IdentifierValue.GetHashCode();
+ if (PositiveIntValue != 0UL) hash ^= PositiveIntValue.GetHashCode();
+ if (NegativeIntValue != 0L) hash ^= NegativeIntValue.GetHashCode();
+ if (DoubleValue != 0D) hash ^= DoubleValue.GetHashCode();
+ if (StringValue.Length != 0) hash ^= StringValue.GetHashCode();
+ if (AggregateValue.Length != 0) hash ^= AggregateValue.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ name_.WriteTo(output, _repeated_name_codec);
+ if (IdentifierValue.Length != 0) {
+ output.WriteRawTag(26);
+ output.WriteString(IdentifierValue);
+ }
+ if (PositiveIntValue != 0UL) {
+ output.WriteRawTag(32);
+ output.WriteUInt64(PositiveIntValue);
+ }
+ if (NegativeIntValue != 0L) {
+ output.WriteRawTag(40);
+ output.WriteInt64(NegativeIntValue);
+ }
+ if (DoubleValue != 0D) {
+ output.WriteRawTag(49);
+ output.WriteDouble(DoubleValue);
+ }
+ if (StringValue.Length != 0) {
+ output.WriteRawTag(58);
+ output.WriteBytes(StringValue);
+ }
+ if (AggregateValue.Length != 0) {
+ output.WriteRawTag(66);
+ output.WriteString(AggregateValue);
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ size += name_.CalculateSize(_repeated_name_codec);
+ if (IdentifierValue.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(IdentifierValue);
+ }
+ if (PositiveIntValue != 0UL) {
+ size += 1 + pb::CodedOutputStream.ComputeUInt64Size(PositiveIntValue);
+ }
+ if (NegativeIntValue != 0L) {
+ size += 1 + pb::CodedOutputStream.ComputeInt64Size(NegativeIntValue);
+ }
+ if (DoubleValue != 0D) {
+ size += 1 + 8;
+ }
+ if (StringValue.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeBytesSize(StringValue);
+ }
+ if (AggregateValue.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(AggregateValue);
+ }
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(UninterpretedOption other) {
+ if (other == null) {
+ return;
+ }
+ name_.Add(other.name_);
+ if (other.IdentifierValue.Length != 0) {
+ IdentifierValue = other.IdentifierValue;
+ }
+ if (other.PositiveIntValue != 0UL) {
+ PositiveIntValue = other.PositiveIntValue;
+ }
+ if (other.NegativeIntValue != 0L) {
+ NegativeIntValue = other.NegativeIntValue;
+ }
+ if (other.DoubleValue != 0D) {
+ DoubleValue = other.DoubleValue;
+ }
+ if (other.StringValue.Length != 0) {
+ StringValue = other.StringValue;
+ }
+ if (other.AggregateValue.Length != 0) {
+ AggregateValue = other.AggregateValue;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 18: {
+ name_.AddEntriesFrom(input, _repeated_name_codec);
+ break;
+ }
+ case 26: {
+ IdentifierValue = input.ReadString();
+ break;
+ }
+ case 32: {
+ PositiveIntValue = input.ReadUInt64();
+ break;
+ }
+ case 40: {
+ NegativeIntValue = input.ReadInt64();
+ break;
+ }
+ case 49: {
+ DoubleValue = input.ReadDouble();
+ break;
+ }
+ case 58: {
+ StringValue = input.ReadBytes();
+ break;
+ }
+ case 66: {
+ AggregateValue = input.ReadString();
+ break;
+ }
+ }
+ }
+ }
+
+ #region Nested types
+ /// <summary>Container for nested types declared in the UninterpretedOption message type.</summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static partial class Types {
+ /// <summary>
+ /// The name of the uninterpreted option. Each string represents a segment in
+ /// a dot-separated name. is_extension is true iff a segment represents an
+ /// extension (denoted with parentheses in options specs in .proto files).
+ /// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
+ /// "foo.(bar.baz).qux".
+ /// </summary>
+ internal sealed partial class NamePart : pb::IMessage<NamePart> {
+ private static readonly pb::MessageParser<NamePart> _parser = new pb::MessageParser<NamePart>(() => new NamePart());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<NamePart> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.UninterpretedOption.Descriptor.NestedTypes[0]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public NamePart() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public NamePart(NamePart other) : this() {
+ namePart_ = other.namePart_;
+ isExtension_ = other.isExtension_;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public NamePart Clone() {
+ return new NamePart(this);
+ }
+
+ /// <summary>Field number for the "name_part" field.</summary>
+ public const int NamePart_FieldNumber = 1;
+ private string namePart_ = "";
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string NamePart_ {
+ get { return namePart_; }
+ set {
+ namePart_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "is_extension" field.</summary>
+ public const int IsExtensionFieldNumber = 2;
+ private bool isExtension_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool IsExtension {
+ get { return isExtension_; }
+ set {
+ isExtension_ = value;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as NamePart);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(NamePart other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (NamePart_ != other.NamePart_) return false;
+ if (IsExtension != other.IsExtension) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (NamePart_.Length != 0) hash ^= NamePart_.GetHashCode();
+ if (IsExtension != false) hash ^= IsExtension.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (NamePart_.Length != 0) {
+ output.WriteRawTag(10);
+ output.WriteString(NamePart_);
+ }
+ if (IsExtension != false) {
+ output.WriteRawTag(16);
+ output.WriteBool(IsExtension);
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ if (NamePart_.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(NamePart_);
+ }
+ if (IsExtension != false) {
+ size += 1 + 1;
+ }
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(NamePart other) {
+ if (other == null) {
+ return;
+ }
+ if (other.NamePart_.Length != 0) {
+ NamePart_ = other.NamePart_;
+ }
+ if (other.IsExtension != false) {
+ IsExtension = other.IsExtension;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 10: {
+ NamePart_ = input.ReadString();
+ break;
+ }
+ case 16: {
+ IsExtension = input.ReadBool();
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ }
+ #endregion
+
+ }
+
+ /// <summary>
+ /// Encapsulates information about the original source file from which a
+ /// FileDescriptorProto was generated.
+ /// </summary>
+ internal sealed partial class SourceCodeInfo : pb::IMessage<SourceCodeInfo> {
+ private static readonly pb::MessageParser<SourceCodeInfo> _parser = new pb::MessageParser<SourceCodeInfo>(() => new SourceCodeInfo());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<SourceCodeInfo> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[18]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public SourceCodeInfo() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public SourceCodeInfo(SourceCodeInfo other) : this() {
+ location_ = other.location_.Clone();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public SourceCodeInfo Clone() {
+ return new SourceCodeInfo(this);
+ }
+
+ /// <summary>Field number for the "location" field.</summary>
+ public const int LocationFieldNumber = 1;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location> _repeated_location_codec
+ = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location> location_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location>();
+ /// <summary>
+ /// A Location identifies a piece of source code in a .proto file which
+ /// corresponds to a particular definition. This information is intended
+ /// to be useful to IDEs, code indexers, documentation generators, and similar
+ /// tools.
+ ///
+ /// For example, say we have a file like:
+ /// message Foo {
+ /// optional string foo = 1;
+ /// }
+ /// Let's look at just the field definition:
+ /// optional string foo = 1;
+ /// ^ ^^ ^^ ^ ^^^
+ /// a bc de f ghi
+ /// We have the following locations:
+ /// span path represents
+ /// [a,i) [ 4, 0, 2, 0 ] The whole field definition.
+ /// [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
+ /// [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
+ /// [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
+ /// [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
+ ///
+ /// Notes:
+ /// - A location may refer to a repeated field itself (i.e. not to any
+ /// particular index within it). This is used whenever a set of elements are
+ /// logically enclosed in a single code segment. For example, an entire
+ /// extend block (possibly containing multiple extension definitions) will
+ /// have an outer location whose path refers to the "extensions" repeated
+ /// field without an index.
+ /// - Multiple locations may have the same path. This happens when a single
+ /// logical declaration is spread out across multiple places. The most
+ /// obvious example is the "extend" block again -- there may be multiple
+ /// extend blocks in the same scope, each of which will have the same path.
+ /// - A location's span is not always a subset of its parent's span. For
+ /// example, the "extendee" of an extension declaration appears at the
+ /// beginning of the "extend" block and is shared by all extensions within
+ /// the block.
+ /// - Just because a location's span is a subset of some other location's span
+ /// does not mean that it is a descendent. For example, a "group" defines
+ /// both a type and a field in a single declaration. Thus, the locations
+ /// corresponding to the type and field and their components will overlap.
+ /// - Code which tries to interpret locations should probably be designed to
+ /// ignore those that it doesn't understand, as more types of locations could
+ /// be recorded in the future.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location> Location {
+ get { return location_; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as SourceCodeInfo);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(SourceCodeInfo other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if(!location_.Equals(other.location_)) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ hash ^= location_.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ location_.WriteTo(output, _repeated_location_codec);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ size += location_.CalculateSize(_repeated_location_codec);
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(SourceCodeInfo other) {
+ if (other == null) {
+ return;
+ }
+ location_.Add(other.location_);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 10: {
+ location_.AddEntriesFrom(input, _repeated_location_codec);
+ break;
+ }
+ }
+ }
+ }
+
+ #region Nested types
+ /// <summary>Container for nested types declared in the SourceCodeInfo message type.</summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static partial class Types {
+ internal sealed partial class Location : pb::IMessage<Location> {
+ private static readonly pb::MessageParser<Location> _parser = new pb::MessageParser<Location>(() => new Location());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<Location> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.SourceCodeInfo.Descriptor.NestedTypes[0]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public Location() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public Location(Location other) : this() {
+ path_ = other.path_.Clone();
+ span_ = other.span_.Clone();
+ leadingComments_ = other.leadingComments_;
+ trailingComments_ = other.trailingComments_;
+ leadingDetachedComments_ = other.leadingDetachedComments_.Clone();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public Location Clone() {
+ return new Location(this);
+ }
+
+ /// <summary>Field number for the "path" field.</summary>
+ public const int PathFieldNumber = 1;
+ private static readonly pb::FieldCodec<int> _repeated_path_codec
+ = pb::FieldCodec.ForInt32(10);
+ private readonly pbc::RepeatedField<int> path_ = new pbc::RepeatedField<int>();
+ /// <summary>
+ /// Identifies which part of the FileDescriptorProto was defined at this
+ /// location.
+ ///
+ /// Each element is a field number or an index. They form a path from
+ /// the root FileDescriptorProto to the place where the definition. For
+ /// example, this path:
+ /// [ 4, 3, 2, 7, 1 ]
+ /// refers to:
+ /// file.message_type(3) // 4, 3
+ /// .field(7) // 2, 7
+ /// .name() // 1
+ /// This is because FileDescriptorProto.message_type has field number 4:
+ /// repeated DescriptorProto message_type = 4;
+ /// and DescriptorProto.field has field number 2:
+ /// repeated FieldDescriptorProto field = 2;
+ /// and FieldDescriptorProto.name has field number 1:
+ /// optional string name = 1;
+ ///
+ /// Thus, the above path gives the location of a field name. If we removed
+ /// the last element:
+ /// [ 4, 3, 2, 7 ]
+ /// this path refers to the whole field declaration (from the beginning
+ /// of the label to the terminating semicolon).
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<int> Path {
+ get { return path_; }
+ }
+
+ /// <summary>Field number for the "span" field.</summary>
+ public const int SpanFieldNumber = 2;
+ private static readonly pb::FieldCodec<int> _repeated_span_codec
+ = pb::FieldCodec.ForInt32(18);
+ private readonly pbc::RepeatedField<int> span_ = new pbc::RepeatedField<int>();
+ /// <summary>
+ /// Always has exactly three or four elements: start line, start column,
+ /// end line (optional, otherwise assumed same as start line), end column.
+ /// These are packed into a single field for efficiency. Note that line
+ /// and column numbers are zero-based -- typically you will want to add
+ /// 1 to each before displaying to a user.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<int> Span {
+ get { return span_; }
+ }
+
+ /// <summary>Field number for the "leading_comments" field.</summary>
+ public const int LeadingCommentsFieldNumber = 3;
+ private string leadingComments_ = "";
+ /// <summary>
+ /// If this SourceCodeInfo represents a complete declaration, these are any
+ /// comments appearing before and after the declaration which appear to be
+ /// attached to the declaration.
+ ///
+ /// A series of line comments appearing on consecutive lines, with no other
+ /// tokens appearing on those lines, will be treated as a single comment.
+ ///
+ /// leading_detached_comments will keep paragraphs of comments that appear
+ /// before (but not connected to) the current element. Each paragraph,
+ /// separated by empty lines, will be one comment element in the repeated
+ /// field.
+ ///
+ /// Only the comment content is provided; comment markers (e.g. //) are
+ /// stripped out. For block comments, leading whitespace and an asterisk
+ /// will be stripped from the beginning of each line other than the first.
+ /// Newlines are included in the output.
+ ///
+ /// Examples:
+ ///
+ /// optional int32 foo = 1; // Comment attached to foo.
+ /// // Comment attached to bar.
+ /// optional int32 bar = 2;
+ ///
+ /// optional string baz = 3;
+ /// // Comment attached to baz.
+ /// // Another line attached to baz.
+ ///
+ /// // Comment attached to qux.
+ /// //
+ /// // Another line attached to qux.
+ /// optional double qux = 4;
+ ///
+ /// // Detached comment for corge. This is not leading or trailing comments
+ /// // to qux or corge because there are blank lines separating it from
+ /// // both.
+ ///
+ /// // Detached comment for corge paragraph 2.
+ ///
+ /// optional string corge = 5;
+ /// /* Block comment attached
+ /// * to corge. Leading asterisks
+ /// * will be removed. */
+ /// /* Block comment attached to
+ /// * grault. */
+ /// optional int32 grault = 6;
+ ///
+ /// // ignored detached comments.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string LeadingComments {
+ get { return leadingComments_; }
+ set {
+ leadingComments_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "trailing_comments" field.</summary>
+ public const int TrailingCommentsFieldNumber = 4;
+ private string trailingComments_ = "";
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string TrailingComments {
+ get { return trailingComments_; }
+ set {
+ trailingComments_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "leading_detached_comments" field.</summary>
+ public const int LeadingDetachedCommentsFieldNumber = 6;
+ private static readonly pb::FieldCodec<string> _repeated_leadingDetachedComments_codec
+ = pb::FieldCodec.ForString(50);
+ private readonly pbc::RepeatedField<string> leadingDetachedComments_ = new pbc::RepeatedField<string>();
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<string> LeadingDetachedComments {
+ get { return leadingDetachedComments_; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as Location);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(Location other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if(!path_.Equals(other.path_)) return false;
+ if(!span_.Equals(other.span_)) return false;
+ if (LeadingComments != other.LeadingComments) return false;
+ if (TrailingComments != other.TrailingComments) return false;
+ if(!leadingDetachedComments_.Equals(other.leadingDetachedComments_)) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ hash ^= path_.GetHashCode();
+ hash ^= span_.GetHashCode();
+ if (LeadingComments.Length != 0) hash ^= LeadingComments.GetHashCode();
+ if (TrailingComments.Length != 0) hash ^= TrailingComments.GetHashCode();
+ hash ^= leadingDetachedComments_.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ path_.WriteTo(output, _repeated_path_codec);
+ span_.WriteTo(output, _repeated_span_codec);
+ if (LeadingComments.Length != 0) {
+ output.WriteRawTag(26);
+ output.WriteString(LeadingComments);
+ }
+ if (TrailingComments.Length != 0) {
+ output.WriteRawTag(34);
+ output.WriteString(TrailingComments);
+ }
+ leadingDetachedComments_.WriteTo(output, _repeated_leadingDetachedComments_codec);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ size += path_.CalculateSize(_repeated_path_codec);
+ size += span_.CalculateSize(_repeated_span_codec);
+ if (LeadingComments.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(LeadingComments);
+ }
+ if (TrailingComments.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(TrailingComments);
+ }
+ size += leadingDetachedComments_.CalculateSize(_repeated_leadingDetachedComments_codec);
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(Location other) {
+ if (other == null) {
+ return;
+ }
+ path_.Add(other.path_);
+ span_.Add(other.span_);
+ if (other.LeadingComments.Length != 0) {
+ LeadingComments = other.LeadingComments;
+ }
+ if (other.TrailingComments.Length != 0) {
+ TrailingComments = other.TrailingComments;
+ }
+ leadingDetachedComments_.Add(other.leadingDetachedComments_);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 10:
+ case 8: {
+ path_.AddEntriesFrom(input, _repeated_path_codec);
+ break;
+ }
+ case 18:
+ case 16: {
+ span_.AddEntriesFrom(input, _repeated_span_codec);
+ break;
+ }
+ case 26: {
+ LeadingComments = input.ReadString();
+ break;
+ }
+ case 34: {
+ TrailingComments = input.ReadString();
+ break;
+ }
+ case 50: {
+ leadingDetachedComments_.AddEntriesFrom(input, _repeated_leadingDetachedComments_codec);
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ }
+ #endregion
+
+ }
+
+ /// <summary>
+ /// Describes the relationship between generated code and its original source
+ /// file. A GeneratedCodeInfo message is associated with only one generated
+ /// source file, but may contain references to different source .proto files.
+ /// </summary>
+ internal sealed partial class GeneratedCodeInfo : pb::IMessage<GeneratedCodeInfo> {
+ private static readonly pb::MessageParser<GeneratedCodeInfo> _parser = new pb::MessageParser<GeneratedCodeInfo>(() => new GeneratedCodeInfo());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<GeneratedCodeInfo> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[19]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public GeneratedCodeInfo() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public GeneratedCodeInfo(GeneratedCodeInfo other) : this() {
+ annotation_ = other.annotation_.Clone();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public GeneratedCodeInfo Clone() {
+ return new GeneratedCodeInfo(this);
+ }
+
+ /// <summary>Field number for the "annotation" field.</summary>
+ public const int AnnotationFieldNumber = 1;
+ private static readonly pb::FieldCodec<global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation> _repeated_annotation_codec
+ = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation.Parser);
+ private readonly pbc::RepeatedField<global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation> annotation_ = new pbc::RepeatedField<global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation>();
+ /// <summary>
+ /// An Annotation connects some span of text in generated code to an element
+ /// of its generating .proto file.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation> Annotation {
+ get { return annotation_; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as GeneratedCodeInfo);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(GeneratedCodeInfo other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if(!annotation_.Equals(other.annotation_)) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ hash ^= annotation_.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ annotation_.WriteTo(output, _repeated_annotation_codec);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ size += annotation_.CalculateSize(_repeated_annotation_codec);
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(GeneratedCodeInfo other) {
+ if (other == null) {
+ return;
+ }
+ annotation_.Add(other.annotation_);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 10: {
+ annotation_.AddEntriesFrom(input, _repeated_annotation_codec);
+ break;
+ }
+ }
+ }
+ }
+
+ #region Nested types
+ /// <summary>Container for nested types declared in the GeneratedCodeInfo message type.</summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static partial class Types {
+ internal sealed partial class Annotation : pb::IMessage<Annotation> {
+ private static readonly pb::MessageParser<Annotation> _parser = new pb::MessageParser<Annotation>(() => new Annotation());
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pb::MessageParser<Annotation> Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.GeneratedCodeInfo.Descriptor.NestedTypes[0]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public Annotation() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public Annotation(Annotation other) : this() {
+ path_ = other.path_.Clone();
+ sourceFile_ = other.sourceFile_;
+ begin_ = other.begin_;
+ end_ = other.end_;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public Annotation Clone() {
+ return new Annotation(this);
+ }
+
+ /// <summary>Field number for the "path" field.</summary>
+ public const int PathFieldNumber = 1;
+ private static readonly pb::FieldCodec<int> _repeated_path_codec
+ = pb::FieldCodec.ForInt32(10);
+ private readonly pbc::RepeatedField<int> path_ = new pbc::RepeatedField<int>();
+ /// <summary>
+ /// Identifies the element in the original source .proto file. This field
+ /// is formatted the same as SourceCodeInfo.Location.path.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<int> Path {
+ get { return path_; }
+ }
+
+ /// <summary>Field number for the "source_file" field.</summary>
+ public const int SourceFileFieldNumber = 2;
+ private string sourceFile_ = "";
+ /// <summary>
+ /// Identifies the filesystem path to the original source .proto.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public string SourceFile {
+ get { return sourceFile_; }
+ set {
+ sourceFile_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+
+ /// <summary>Field number for the "begin" field.</summary>
+ public const int BeginFieldNumber = 3;
+ private int begin_;
+ /// <summary>
+ /// Identifies the starting offset in bytes in the generated code
+ /// that relates to the identified object.
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int Begin {
+ get { return begin_; }
+ set {
+ begin_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "end" field.</summary>
+ public const int EndFieldNumber = 4;
+ private int end_;
+ /// <summary>
+ /// Identifies the ending offset in bytes in the generated code that
+ /// relates to the identified offset. The end offset should be one past
+ /// the last relevant byte (so the length of the text = end - begin).
+ /// </summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int End {
+ get { return end_; }
+ set {
+ end_ = value;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override bool Equals(object other) {
+ return Equals(other as Annotation);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public bool Equals(Annotation other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if(!path_.Equals(other.path_)) return false;
+ if (SourceFile != other.SourceFile) return false;
+ if (Begin != other.Begin) return false;
+ if (End != other.End) return false;
+ return true;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override int GetHashCode() {
+ int hash = 1;
+ hash ^= path_.GetHashCode();
+ if (SourceFile.Length != 0) hash ^= SourceFile.GetHashCode();
+ if (Begin != 0) hash ^= Begin.GetHashCode();
+ if (End != 0) hash ^= End.GetHashCode();
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void WriteTo(pb::CodedOutputStream output) {
+ path_.WriteTo(output, _repeated_path_codec);
+ if (SourceFile.Length != 0) {
+ output.WriteRawTag(18);
+ output.WriteString(SourceFile);
+ }
+ if (Begin != 0) {
+ output.WriteRawTag(24);
+ output.WriteInt32(Begin);
+ }
+ if (End != 0) {
+ output.WriteRawTag(32);
+ output.WriteInt32(End);
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public int CalculateSize() {
+ int size = 0;
+ size += path_.CalculateSize(_repeated_path_codec);
+ if (SourceFile.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(SourceFile);
+ }
+ if (Begin != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeInt32Size(Begin);
+ }
+ if (End != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeInt32Size(End);
+ }
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(Annotation other) {
+ if (other == null) {
+ return;
+ }
+ path_.Add(other.path_);
+ if (other.SourceFile.Length != 0) {
+ SourceFile = other.SourceFile;
+ }
+ if (other.Begin != 0) {
+ Begin = other.Begin;
+ }
+ if (other.End != 0) {
+ End = other.End;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while ((tag = input.ReadTag()) != 0) {
+ switch(tag) {
+ default:
+ input.SkipLastField();
+ break;
+ case 10:
+ case 8: {
+ path_.AddEntriesFrom(input, _repeated_path_codec);
+ break;
+ }
+ case 18: {
+ SourceFile = input.ReadString();
+ break;
+ }
+ case 24: {
+ Begin = input.ReadInt32();
+ break;
+ }
+ case 32: {
+ End = input.ReadInt32();
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ }
+ #endregion
+
+ }
+
+ #endregion
+
+}
+
+#endregion Designer generated code
diff --git a/csharp/src/Google.Protobuf/Reflection/DescriptorBase.cs b/csharp/src/Google.Protobuf/Reflection/DescriptorBase.cs
new file mode 100644
index 00000000..194041a8
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/DescriptorBase.cs
@@ -0,0 +1,85 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Base class for nearly all descriptors, providing common functionality.
+ /// </summary>
+ public abstract class DescriptorBase : IDescriptor
+ {
+ private readonly FileDescriptor file;
+ private readonly string fullName;
+ private readonly int index;
+
+ internal DescriptorBase(FileDescriptor file, string fullName, int index)
+ {
+ this.file = file;
+ this.fullName = fullName;
+ this.index = index;
+ }
+
+ /// <value>
+ /// The index of this descriptor within its parent descriptor.
+ /// </value>
+ /// <remarks>
+ /// This returns the index of this descriptor within its parent, for
+ /// this descriptor's type. (There can be duplicate values for different
+ /// types, e.g. one enum type with index 0 and one message type with index 0.)
+ /// </remarks>
+ public int Index
+ {
+ get { return index; }
+ }
+
+ /// <summary>
+ /// Returns the name of the entity (field, message etc) being described.
+ /// </summary>
+ public abstract string Name { get; }
+
+ /// <summary>
+ /// The fully qualified name of the descriptor's target.
+ /// </summary>
+ public string FullName
+ {
+ get { return fullName; }
+ }
+
+ /// <value>
+ /// The file this descriptor was declared in.
+ /// </value>
+ public FileDescriptor File
+ {
+ get { return file; }
+ }
+ }
+} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs b/csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs
new file mode 100644
index 00000000..99ca4bf3
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs
@@ -0,0 +1,368 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Contains lookup tables containing all the descriptors defined in a particular file.
+ /// </summary>
+ internal sealed class DescriptorPool
+ {
+ private readonly IDictionary<string, IDescriptor> descriptorsByName =
+ new Dictionary<string, IDescriptor>();
+
+ private readonly IDictionary<DescriptorIntPair, FieldDescriptor> fieldsByNumber =
+ new Dictionary<DescriptorIntPair, FieldDescriptor>();
+
+ private readonly IDictionary<DescriptorIntPair, EnumValueDescriptor> enumValuesByNumber =
+ new Dictionary<DescriptorIntPair, EnumValueDescriptor>();
+
+ private readonly HashSet<FileDescriptor> dependencies;
+
+ internal DescriptorPool(FileDescriptor[] dependencyFiles)
+ {
+ dependencies = new HashSet<FileDescriptor>();
+ for (int i = 0; i < dependencyFiles.Length; i++)
+ {
+ dependencies.Add(dependencyFiles[i]);
+ ImportPublicDependencies(dependencyFiles[i]);
+ }
+
+ foreach (FileDescriptor dependency in dependencyFiles)
+ {
+ AddPackage(dependency.Package, dependency);
+ }
+ }
+
+ private void ImportPublicDependencies(FileDescriptor file)
+ {
+ foreach (FileDescriptor dependency in file.PublicDependencies)
+ {
+ if (dependencies.Add(dependency))
+ {
+ ImportPublicDependencies(dependency);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Finds a symbol of the given name within the pool.
+ /// </summary>
+ /// <typeparam name="T">The type of symbol to look for</typeparam>
+ /// <param name="fullName">Fully-qualified name to look up</param>
+ /// <returns>The symbol with the given name and type,
+ /// or null if the symbol doesn't exist or has the wrong type</returns>
+ internal T FindSymbol<T>(string fullName) where T : class
+ {
+ IDescriptor result;
+ descriptorsByName.TryGetValue(fullName, out result);
+ T descriptor = result as T;
+ if (descriptor != null)
+ {
+ return descriptor;
+ }
+
+ // dependencies contains direct dependencies and any *public* dependencies
+ // of those dependencies (transitively)... so we don't need to recurse here.
+ foreach (FileDescriptor dependency in dependencies)
+ {
+ dependency.DescriptorPool.descriptorsByName.TryGetValue(fullName, out result);
+ descriptor = result as T;
+ if (descriptor != null)
+ {
+ return descriptor;
+ }
+ }
+
+ return null;
+ }
+
+ /// <summary>
+ /// Adds a package to the symbol tables. If a package by the same name
+ /// already exists, that is fine, but if some other kind of symbol
+ /// exists under the same name, an exception is thrown. If the package
+ /// has multiple components, this also adds the parent package(s).
+ /// </summary>
+ internal void AddPackage(string fullName, FileDescriptor file)
+ {
+ int dotpos = fullName.LastIndexOf('.');
+ String name;
+ if (dotpos != -1)
+ {
+ AddPackage(fullName.Substring(0, dotpos), file);
+ name = fullName.Substring(dotpos + 1);
+ }
+ else
+ {
+ name = fullName;
+ }
+
+ IDescriptor old;
+ if (descriptorsByName.TryGetValue(fullName, out old))
+ {
+ if (!(old is PackageDescriptor))
+ {
+ throw new DescriptorValidationException(file,
+ "\"" + name +
+ "\" is already defined (as something other than a " +
+ "package) in file \"" + old.File.Name + "\".");
+ }
+ }
+ descriptorsByName[fullName] = new PackageDescriptor(name, fullName, file);
+ }
+
+ /// <summary>
+ /// Adds a symbol to the symbol table.
+ /// </summary>
+ /// <exception cref="DescriptorValidationException">The symbol already existed
+ /// in the symbol table.</exception>
+ internal void AddSymbol(IDescriptor descriptor)
+ {
+ ValidateSymbolName(descriptor);
+ String fullName = descriptor.FullName;
+
+ IDescriptor old;
+ if (descriptorsByName.TryGetValue(fullName, out old))
+ {
+ int dotPos = fullName.LastIndexOf('.');
+ string message;
+ if (descriptor.File == old.File)
+ {
+ if (dotPos == -1)
+ {
+ message = "\"" + fullName + "\" is already defined.";
+ }
+ else
+ {
+ message = "\"" + fullName.Substring(dotPos + 1) + "\" is already defined in \"" +
+ fullName.Substring(0, dotPos) + "\".";
+ }
+ }
+ else
+ {
+ message = "\"" + fullName + "\" is already defined in file \"" + old.File.Name + "\".";
+ }
+ throw new DescriptorValidationException(descriptor, message);
+ }
+ descriptorsByName[fullName] = descriptor;
+ }
+
+ private static readonly Regex ValidationRegex = new Regex("^[_A-Za-z][_A-Za-z0-9]*$",
+ FrameworkPortability.CompiledRegexWhereAvailable);
+
+ /// <summary>
+ /// Verifies that the descriptor's name is valid (i.e. it contains
+ /// only letters, digits and underscores, and does not start with a digit).
+ /// </summary>
+ /// <param name="descriptor"></param>
+ private static void ValidateSymbolName(IDescriptor descriptor)
+ {
+ if (descriptor.Name == "")
+ {
+ throw new DescriptorValidationException(descriptor, "Missing name.");
+ }
+ if (!ValidationRegex.IsMatch(descriptor.Name))
+ {
+ throw new DescriptorValidationException(descriptor,
+ "\"" + descriptor.Name + "\" is not a valid identifier.");
+ }
+ }
+
+ /// <summary>
+ /// Returns the field with the given number in the given descriptor,
+ /// or null if it can't be found.
+ /// </summary>
+ internal FieldDescriptor FindFieldByNumber(MessageDescriptor messageDescriptor, int number)
+ {
+ FieldDescriptor ret;
+ fieldsByNumber.TryGetValue(new DescriptorIntPair(messageDescriptor, number), out ret);
+ return ret;
+ }
+
+ internal EnumValueDescriptor FindEnumValueByNumber(EnumDescriptor enumDescriptor, int number)
+ {
+ EnumValueDescriptor ret;
+ enumValuesByNumber.TryGetValue(new DescriptorIntPair(enumDescriptor, number), out ret);
+ return ret;
+ }
+
+ /// <summary>
+ /// Adds a field to the fieldsByNumber table.
+ /// </summary>
+ /// <exception cref="DescriptorValidationException">A field with the same
+ /// containing type and number already exists.</exception>
+ internal void AddFieldByNumber(FieldDescriptor field)
+ {
+ DescriptorIntPair key = new DescriptorIntPair(field.ContainingType, field.FieldNumber);
+ FieldDescriptor old;
+ if (fieldsByNumber.TryGetValue(key, out old))
+ {
+ throw new DescriptorValidationException(field, "Field number " + field.FieldNumber +
+ "has already been used in \"" +
+ field.ContainingType.FullName +
+ "\" by field \"" + old.Name + "\".");
+ }
+ fieldsByNumber[key] = field;
+ }
+
+ /// <summary>
+ /// Adds an enum value to the enumValuesByNumber table. If an enum value
+ /// with the same type and number already exists, this method does nothing.
+ /// (This is allowed; the first value defined with the number takes precedence.)
+ /// </summary>
+ internal void AddEnumValueByNumber(EnumValueDescriptor enumValue)
+ {
+ DescriptorIntPair key = new DescriptorIntPair(enumValue.EnumDescriptor, enumValue.Number);
+ if (!enumValuesByNumber.ContainsKey(key))
+ {
+ enumValuesByNumber[key] = enumValue;
+ }
+ }
+
+ /// <summary>
+ /// Looks up a descriptor by name, relative to some other descriptor.
+ /// The name may be fully-qualified (with a leading '.'), partially-qualified,
+ /// or unqualified. C++-like name lookup semantics are used to search for the
+ /// matching descriptor.
+ /// </summary>
+ /// <remarks>
+ /// This isn't heavily optimized, but it's only used during cross linking anyway.
+ /// If it starts being used more widely, we should look at performance more carefully.
+ /// </remarks>
+ internal IDescriptor LookupSymbol(string name, IDescriptor relativeTo)
+ {
+ IDescriptor result;
+ if (name.StartsWith("."))
+ {
+ // Fully-qualified name.
+ result = FindSymbol<IDescriptor>(name.Substring(1));
+ }
+ else
+ {
+ // If "name" is a compound identifier, we want to search for the
+ // first component of it, then search within it for the rest.
+ int firstPartLength = name.IndexOf('.');
+ string firstPart = firstPartLength == -1 ? name : name.Substring(0, firstPartLength);
+
+ // We will search each parent scope of "relativeTo" looking for the
+ // symbol.
+ StringBuilder scopeToTry = new StringBuilder(relativeTo.FullName);
+
+ while (true)
+ {
+ // Chop off the last component of the scope.
+
+ int dotpos = scopeToTry.ToString().LastIndexOf(".");
+ if (dotpos == -1)
+ {
+ result = FindSymbol<IDescriptor>(name);
+ break;
+ }
+ else
+ {
+ scopeToTry.Length = dotpos + 1;
+
+ // Append firstPart and try to find.
+ scopeToTry.Append(firstPart);
+ result = FindSymbol<IDescriptor>(scopeToTry.ToString());
+
+ if (result != null)
+ {
+ if (firstPartLength != -1)
+ {
+ // We only found the first part of the symbol. Now look for
+ // the whole thing. If this fails, we *don't* want to keep
+ // searching parent scopes.
+ scopeToTry.Length = dotpos + 1;
+ scopeToTry.Append(name);
+ result = FindSymbol<IDescriptor>(scopeToTry.ToString());
+ }
+ break;
+ }
+
+ // Not found. Remove the name so we can try again.
+ scopeToTry.Length = dotpos;
+ }
+ }
+ }
+
+ if (result == null)
+ {
+ throw new DescriptorValidationException(relativeTo, "\"" + name + "\" is not defined.");
+ }
+ else
+ {
+ return result;
+ }
+ }
+
+ /// <summary>
+ /// Struct used to hold the keys for the fieldByNumber table.
+ /// </summary>
+ private struct DescriptorIntPair : IEquatable<DescriptorIntPair>
+ {
+ private readonly int number;
+ private readonly IDescriptor descriptor;
+
+ internal DescriptorIntPair(IDescriptor descriptor, int number)
+ {
+ this.number = number;
+ this.descriptor = descriptor;
+ }
+
+ public bool Equals(DescriptorIntPair other)
+ {
+ return descriptor == other.descriptor
+ && number == other.number;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj is DescriptorIntPair)
+ {
+ return Equals((DescriptorIntPair) obj);
+ }
+ return false;
+ }
+
+ public override int GetHashCode()
+ {
+ return descriptor.GetHashCode()*((1 << 16) - 1) + number;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Reflection/DescriptorUtil.cs b/csharp/src/Google.Protobuf/Reflection/DescriptorUtil.cs
new file mode 100644
index 00000000..f5570fc4
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/DescriptorUtil.cs
@@ -0,0 +1,64 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Internal class containing utility methods when working with descriptors.
+ /// </summary>
+ internal static class DescriptorUtil
+ {
+ /// <summary>
+ /// Equivalent to Func[TInput, int, TOutput] but usable in .NET 2.0. Only used to convert
+ /// arrays.
+ /// </summary>
+ internal delegate TOutput IndexedConverter<TInput, TOutput>(TInput element, int index);
+
+ /// <summary>
+ /// Converts the given array into a read-only list, applying the specified conversion to
+ /// each input element.
+ /// </summary>
+ internal static IList<TOutput> ConvertAndMakeReadOnly<TInput, TOutput>
+ (IList<TInput> input, IndexedConverter<TInput, TOutput> converter)
+ {
+ TOutput[] array = new TOutput[input.Count];
+ for (int i = 0; i < array.Length; i++)
+ {
+ array[i] = converter(input[i], i);
+ }
+ return new ReadOnlyCollection<TOutput>(array);
+ }
+ }
+} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Reflection/DescriptorValidationException.cs b/csharp/src/Google.Protobuf/Reflection/DescriptorValidationException.cs
new file mode 100644
index 00000000..143671db
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/DescriptorValidationException.cs
@@ -0,0 +1,80 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using System;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Thrown when building descriptors fails because the source DescriptorProtos
+ /// are not valid.
+ /// </summary>
+ public sealed class DescriptorValidationException : Exception
+ {
+ private readonly String name;
+ private readonly string description;
+
+ /// <value>
+ /// The full name of the descriptor where the error occurred.
+ /// </value>
+ public String ProblemSymbolName
+ {
+ get { return name; }
+ }
+
+ /// <value>
+ /// A human-readable description of the error. (The Message property
+ /// is made up of the descriptor's name and this description.)
+ /// </value>
+ public string Description
+ {
+ get { return description; }
+ }
+
+ internal DescriptorValidationException(IDescriptor problemDescriptor, string description) :
+ base(problemDescriptor.FullName + ": " + description)
+ {
+ // Note that problemDescriptor may be partially uninitialized, so we
+ // don't want to expose it directly to the user. So, we only provide
+ // the name and the original proto.
+ name = problemDescriptor.FullName;
+ this.description = description;
+ }
+
+ internal DescriptorValidationException(IDescriptor problemDescriptor, string description, Exception cause) :
+ base(problemDescriptor.FullName + ": " + description, cause)
+ {
+ name = problemDescriptor.FullName;
+ this.description = description;
+ }
+ }
+} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs
new file mode 100644
index 00000000..c732c93a
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs
@@ -0,0 +1,116 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Descriptor for an enum type in a .proto file.
+ /// </summary>
+ public sealed class EnumDescriptor : DescriptorBase
+ {
+ private readonly EnumDescriptorProto proto;
+ private readonly MessageDescriptor containingType;
+ private readonly IList<EnumValueDescriptor> values;
+ private readonly Type clrType;
+
+ internal EnumDescriptor(EnumDescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int index, Type clrType)
+ : base(file, file.ComputeFullName(parent, proto.Name), index)
+ {
+ this.proto = proto;
+ this.clrType = clrType;
+ containingType = parent;
+
+ if (proto.Value.Count == 0)
+ {
+ // We cannot allow enums with no values because this would mean there
+ // would be no valid default value for fields of this type.
+ throw new DescriptorValidationException(this, "Enums must contain at least one value.");
+ }
+
+ values = DescriptorUtil.ConvertAndMakeReadOnly(proto.Value,
+ (value, i) => new EnumValueDescriptor(value, file, this, i));
+
+ File.DescriptorPool.AddSymbol(this);
+ }
+
+ internal EnumDescriptorProto Proto { get { return proto; } }
+
+ /// <summary>
+ /// The brief name of the descriptor's target.
+ /// </summary>
+ public override string Name { get { return proto.Name; } }
+
+ /// <summary>
+ /// The CLR type for this enum. For generated code, this will be a CLR enum type.
+ /// </summary>
+ public Type ClrType { get { return clrType; } }
+
+ /// <value>
+ /// If this is a nested type, get the outer descriptor, otherwise null.
+ /// </value>
+ public MessageDescriptor ContainingType
+ {
+ get { return containingType; }
+ }
+
+ /// <value>
+ /// An unmodifiable list of defined value descriptors for this enum.
+ /// </value>
+ public IList<EnumValueDescriptor> Values
+ {
+ get { return values; }
+ }
+
+ /// <summary>
+ /// Finds an enum value by number. If multiple enum values have the
+ /// same number, this returns the first defined value with that number.
+ /// If there is no value for the given number, this returns <c>null</c>.
+ /// </summary>
+ public EnumValueDescriptor FindValueByNumber(int number)
+ {
+ return File.DescriptorPool.FindEnumValueByNumber(this, number);
+ }
+
+ /// <summary>
+ /// Finds an enum value by name.
+ /// </summary>
+ /// <param name="name">The unqualified name of the value (e.g. "FOO").</param>
+ /// <returns>The value's descriptor, or null if not found.</returns>
+ public EnumValueDescriptor FindValueByName(string name)
+ {
+ return File.DescriptorPool.FindSymbol<EnumValueDescriptor>(FullName + "." + name);
+ }
+ }
+} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs
new file mode 100644
index 00000000..b212ce96
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs
@@ -0,0 +1,70 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Descriptor for a single enum value within an enum in a .proto file.
+ /// </summary>
+ public sealed class EnumValueDescriptor : DescriptorBase
+ {
+ private readonly EnumDescriptor enumDescriptor;
+ private readonly EnumValueDescriptorProto proto;
+
+ internal EnumValueDescriptor(EnumValueDescriptorProto proto, FileDescriptor file,
+ EnumDescriptor parent, int index)
+ : base(file, parent.FullName + "." + proto.Name, index)
+ {
+ this.proto = proto;
+ enumDescriptor = parent;
+ file.DescriptorPool.AddSymbol(this);
+ file.DescriptorPool.AddEnumValueByNumber(this);
+ }
+
+ internal EnumValueDescriptorProto Proto { get { return proto; } }
+
+ /// <summary>
+ /// Returns the name of the enum value described by this object.
+ /// </summary>
+ public override string Name { get { return proto.Name; } }
+
+ /// <summary>
+ /// Returns the number associated with this enum value.
+ /// </summary>
+ public int Number { get { return Proto.Number; } }
+
+ /// <summary>
+ /// Returns the enum descriptor that this value is part of.
+ /// </summary>
+ public EnumDescriptor EnumDescriptor { get { return enumDescriptor; } }
+ }
+} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Reflection/FieldAccessorBase.cs b/csharp/src/Google.Protobuf/Reflection/FieldAccessorBase.cs
new file mode 100644
index 00000000..82ce5051
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/FieldAccessorBase.cs
@@ -0,0 +1,63 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2015 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using System;
+using System.Reflection;
+using Google.Protobuf.Compatibility;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Base class for field accessors.
+ /// </summary>
+ internal abstract class FieldAccessorBase : IFieldAccessor
+ {
+ private readonly Func<IMessage, object> getValueDelegate;
+ private readonly FieldDescriptor descriptor;
+
+ internal FieldAccessorBase(PropertyInfo property, FieldDescriptor descriptor)
+ {
+ this.descriptor = descriptor;
+ getValueDelegate = ReflectionUtil.CreateFuncIMessageObject(property.GetGetMethod());
+ }
+
+ public FieldDescriptor Descriptor { get { return descriptor; } }
+
+ public object GetValue(IMessage message)
+ {
+ return getValueDelegate(message);
+ }
+
+ public abstract void Clear(IMessage message);
+ public abstract void SetValue(IMessage message, object value);
+ }
+}
diff --git a/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
new file mode 100644
index 00000000..6c6f6ee0
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
@@ -0,0 +1,343 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using Google.Protobuf.Compatibility;
+using System;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Descriptor for a field or extension within a message in a .proto file.
+ /// </summary>
+ public sealed class FieldDescriptor : DescriptorBase, IComparable<FieldDescriptor>
+ {
+ private EnumDescriptor enumType;
+ private MessageDescriptor messageType;
+ private FieldType fieldType;
+ private readonly string propertyName; // Annoyingly, needed in Crosslink.
+ private IFieldAccessor accessor;
+
+ /// <summary>
+ /// Get the field's containing message type.
+ /// </summary>
+ public MessageDescriptor ContainingType { get; }
+
+ /// <summary>
+ /// Returns the oneof containing this field, or <c>null</c> if it is not part of a oneof.
+ /// </summary>
+ public OneofDescriptor ContainingOneof { get; }
+
+ /// <summary>
+ /// The effective JSON name for this field. This is usually the lower-camel-cased form of the field name,
+ /// but can be overridden using the <c>json_name</c> option in the .proto file.
+ /// </summary>
+ public string JsonName { get; }
+
+ internal FieldDescriptorProto Proto { get; }
+
+ internal FieldDescriptor(FieldDescriptorProto proto, FileDescriptor file,
+ MessageDescriptor parent, int index, string propertyName)
+ : base(file, file.ComputeFullName(parent, proto.Name), index)
+ {
+ Proto = proto;
+ if (proto.Type != 0)
+ {
+ fieldType = GetFieldTypeFromProtoType(proto.Type);
+ }
+
+ if (FieldNumber <= 0)
+ {
+ throw new DescriptorValidationException(this, "Field numbers must be positive integers.");
+ }
+ ContainingType = parent;
+ // OneofIndex "defaults" to -1 due to a hack in FieldDescriptor.OnConstruction.
+ if (proto.OneofIndex != -1)
+ {
+ if (proto.OneofIndex < 0 || proto.OneofIndex >= parent.Proto.OneofDecl.Count)
+ {
+ throw new DescriptorValidationException(this,
+ $"FieldDescriptorProto.oneof_index is out of range for type {parent.Name}");
+ }
+ ContainingOneof = parent.Oneofs[proto.OneofIndex];
+ }
+
+ file.DescriptorPool.AddSymbol(this);
+ // We can't create the accessor until we've cross-linked, unfortunately, as we
+ // may not know whether the type of the field is a map or not. Remember the property name
+ // for later.
+ // We could trust the generated code and check whether the type of the property is
+ // a MapField, but that feels a tad nasty.
+ this.propertyName = propertyName;
+ JsonName = Proto.JsonName == "" ? JsonFormatter.ToCamelCase(Proto.Name) : Proto.JsonName;
+ }
+
+
+ /// <summary>
+ /// The brief name of the descriptor's target.
+ /// </summary>
+ public override string Name => Proto.Name;
+
+ /// <summary>
+ /// Returns the accessor for this field.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// While a <see cref="FieldDescriptor"/> describes the field, it does not provide
+ /// any way of obtaining or changing the value of the field within a specific message;
+ /// that is the responsibility of the accessor.
+ /// </para>
+ /// <para>
+ /// The value returned by this property will be non-null for all regular fields. However,
+ /// if a message containing a map field is introspected, the list of nested messages will include
+ /// an auto-generated nested key/value pair message for the field. This is not represented in any
+ /// generated type, and the value of the map field itself is represented by a dictionary in the
+ /// reflection API. There are never instances of those "hidden" messages, so no accessor is provided
+ /// and this property will return null.
+ /// </para>
+ /// </remarks>
+ public IFieldAccessor Accessor => accessor;
+
+ /// <summary>
+ /// Maps a field type as included in the .proto file to a FieldType.
+ /// </summary>
+ private static FieldType GetFieldTypeFromProtoType(FieldDescriptorProto.Types.Type type)
+ {
+ switch (type)
+ {
+ case FieldDescriptorProto.Types.Type.Double:
+ return FieldType.Double;
+ case FieldDescriptorProto.Types.Type.Float:
+ return FieldType.Float;
+ case FieldDescriptorProto.Types.Type.Int64:
+ return FieldType.Int64;
+ case FieldDescriptorProto.Types.Type.Uint64:
+ return FieldType.UInt64;
+ case FieldDescriptorProto.Types.Type.Int32:
+ return FieldType.Int32;
+ case FieldDescriptorProto.Types.Type.Fixed64:
+ return FieldType.Fixed64;
+ case FieldDescriptorProto.Types.Type.Fixed32:
+ return FieldType.Fixed32;
+ case FieldDescriptorProto.Types.Type.Bool:
+ return FieldType.Bool;
+ case FieldDescriptorProto.Types.Type.String:
+ return FieldType.String;
+ case FieldDescriptorProto.Types.Type.Group:
+ return FieldType.Group;
+ case FieldDescriptorProto.Types.Type.Message:
+ return FieldType.Message;
+ case FieldDescriptorProto.Types.Type.Bytes:
+ return FieldType.Bytes;
+ case FieldDescriptorProto.Types.Type.Uint32:
+ return FieldType.UInt32;
+ case FieldDescriptorProto.Types.Type.Enum:
+ return FieldType.Enum;
+ case FieldDescriptorProto.Types.Type.Sfixed32:
+ return FieldType.SFixed32;
+ case FieldDescriptorProto.Types.Type.Sfixed64:
+ return FieldType.SFixed64;
+ case FieldDescriptorProto.Types.Type.Sint32:
+ return FieldType.SInt32;
+ case FieldDescriptorProto.Types.Type.Sint64:
+ return FieldType.SInt64;
+ default:
+ throw new ArgumentException("Invalid type specified");
+ }
+ }
+
+ /// <summary>
+ /// Returns <c>true</c> if this field is a repeated field; <c>false</c> otherwise.
+ /// </summary>
+ public bool IsRepeated => Proto.Label == FieldDescriptorProto.Types.Label.Repeated;
+
+ /// <summary>
+ /// Returns <c>true</c> if this field is a map field; <c>false</c> otherwise.
+ /// </summary>
+ public bool IsMap => fieldType == FieldType.Message && messageType.Proto.Options != null && messageType.Proto.Options.MapEntry;
+
+ /// <summary>
+ /// Returns <c>true</c> if this field is a packed, repeated field; <c>false</c> otherwise.
+ /// </summary>
+ public bool IsPacked =>
+ // Note the || rather than && here - we're effectively defaulting to packed, because that *is*
+ // the default in proto3, which is all we support. We may give the wrong result for the protos
+ // within descriptor.proto, but that's okay, as they're never exposed and we don't use IsPacked
+ // within the runtime.
+ Proto.Options == null || Proto.Options.Packed;
+
+ /// <summary>
+ /// Returns the type of the field.
+ /// </summary>
+ public FieldType FieldType => fieldType;
+
+ /// <summary>
+ /// Returns the field number declared in the proto file.
+ /// </summary>
+ public int FieldNumber => Proto.Number;
+
+ /// <summary>
+ /// Compares this descriptor with another one, ordering in "canonical" order
+ /// which simply means ascending order by field number. <paramref name="other"/>
+ /// must be a field of the same type, i.e. the <see cref="ContainingType"/> of
+ /// both fields must be the same.
+ /// </summary>
+ public int CompareTo(FieldDescriptor other)
+ {
+ if (other.ContainingType != ContainingType)
+ {
+ throw new ArgumentException("FieldDescriptors can only be compared to other FieldDescriptors " +
+ "for fields of the same message type.");
+ }
+ return FieldNumber - other.FieldNumber;
+ }
+
+ /// <summary>
+ /// For enum fields, returns the field's type.
+ /// </summary>
+ public EnumDescriptor EnumType
+ {
+ get
+ {
+ if (fieldType != FieldType.Enum)
+ {
+ throw new InvalidOperationException("EnumType is only valid for enum fields.");
+ }
+ return enumType;
+ }
+ }
+
+ /// <summary>
+ /// For embedded message and group fields, returns the field's type.
+ /// </summary>
+ public MessageDescriptor MessageType
+ {
+ get
+ {
+ if (fieldType != FieldType.Message)
+ {
+ throw new InvalidOperationException("MessageType is only valid for message fields.");
+ }
+ return messageType;
+ }
+ }
+
+ /// <summary>
+ /// Look up and cross-link all field types etc.
+ /// </summary>
+ internal void CrossLink()
+ {
+ if (Proto.TypeName != "")
+ {
+ IDescriptor typeDescriptor =
+ File.DescriptorPool.LookupSymbol(Proto.TypeName, this);
+
+ if (Proto.Type != 0)
+ {
+ // Choose field type based on symbol.
+ if (typeDescriptor is MessageDescriptor)
+ {
+ fieldType = FieldType.Message;
+ }
+ else if (typeDescriptor is EnumDescriptor)
+ {
+ fieldType = FieldType.Enum;
+ }
+ else
+ {
+ throw new DescriptorValidationException(this, $"\"{Proto.TypeName}\" is not a type.");
+ }
+ }
+
+ if (fieldType == FieldType.Message)
+ {
+ if (!(typeDescriptor is MessageDescriptor))
+ {
+ throw new DescriptorValidationException(this, $"\"{Proto.TypeName}\" is not a message type.");
+ }
+ messageType = (MessageDescriptor) typeDescriptor;
+
+ if (Proto.DefaultValue != "")
+ {
+ throw new DescriptorValidationException(this, "Messages can't have default values.");
+ }
+ }
+ else if (fieldType == FieldType.Enum)
+ {
+ if (!(typeDescriptor is EnumDescriptor))
+ {
+ throw new DescriptorValidationException(this, $"\"{Proto.TypeName}\" is not an enum type.");
+ }
+ enumType = (EnumDescriptor) typeDescriptor;
+ }
+ else
+ {
+ throw new DescriptorValidationException(this, "Field with primitive type has type_name.");
+ }
+ }
+ else
+ {
+ if (fieldType == FieldType.Message || fieldType == FieldType.Enum)
+ {
+ throw new DescriptorValidationException(this, "Field with message or enum type missing type_name.");
+ }
+ }
+
+ // Note: no attempt to perform any default value parsing
+
+ File.DescriptorPool.AddFieldByNumber(this);
+
+ if (ContainingType != null && ContainingType.Proto.Options != null && ContainingType.Proto.Options.MessageSetWireFormat)
+ {
+ throw new DescriptorValidationException(this, "MessageSet format is not supported.");
+ }
+ accessor = CreateAccessor();
+ }
+
+ private IFieldAccessor CreateAccessor()
+ {
+ // If we're given no property name, that's because we really don't want an accessor.
+ // (At the moment, that means it's a map entry message...)
+ if (propertyName == null)
+ {
+ return null;
+ }
+ var property = ContainingType.ClrType.GetProperty(propertyName);
+ if (property == null)
+ {
+ throw new DescriptorValidationException(this, $"Property {propertyName} not found in {ContainingType.ClrType}");
+ }
+ return IsMap ? new MapFieldAccessor(property, this)
+ : IsRepeated ? new RepeatedFieldAccessor(property, this)
+ : (IFieldAccessor) new SingleFieldAccessor(property, this);
+ }
+ }
+} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Reflection/FieldType.cs b/csharp/src/Google.Protobuf/Reflection/FieldType.cs
new file mode 100644
index 00000000..1658e34c
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/FieldType.cs
@@ -0,0 +1,113 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Enumeration of all the possible field types.
+ /// </summary>
+ public enum FieldType
+ {
+ /// <summary>
+ /// The <c>double</c> field type.
+ /// </summary>
+ Double,
+ /// <summary>
+ /// The <c>float</c> field type.
+ /// </summary>
+ Float,
+ /// <summary>
+ /// The <c>int64</c> field type.
+ /// </summary>
+ Int64,
+ /// <summary>
+ /// The <c>uint64</c> field type.
+ /// </summary>
+ UInt64,
+ /// <summary>
+ /// The <c>int32</c> field type.
+ /// </summary>
+ Int32,
+ /// <summary>
+ /// The <c>fixed64</c> field type.
+ /// </summary>
+ Fixed64,
+ /// <summary>
+ /// The <c>fixed32</c> field type.
+ /// </summary>
+ Fixed32,
+ /// <summary>
+ /// The <c>bool</c> field type.
+ /// </summary>
+ Bool,
+ /// <summary>
+ /// The <c>string</c> field type.
+ /// </summary>
+ String,
+ /// <summary>
+ /// The field type used for groups (not supported in this implementation).
+ /// </summary>
+ Group,
+ /// <summary>
+ /// The field type used for message fields.
+ /// </summary>
+ Message,
+ /// <summary>
+ /// The <c>bytes</c> field type.
+ /// </summary>
+ Bytes,
+ /// <summary>
+ /// The <c>uint32</c> field type.
+ /// </summary>
+ UInt32,
+ /// <summary>
+ /// The <c>sfixed32</c> field type.
+ /// </summary>
+ SFixed32,
+ /// <summary>
+ /// The <c>sfixed64</c> field type.
+ /// </summary>
+ SFixed64,
+ /// <summary>
+ /// The <c>sint32</c> field type.
+ /// </summary>
+ SInt32,
+ /// <summary>
+ /// The <c>sint64</c> field type.
+ /// </summary>
+ SInt64,
+ /// <summary>
+ /// The field type used for enum fields.
+ /// </summary>
+ Enum
+ }
+} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs
new file mode 100644
index 00000000..ab7cd922
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs
@@ -0,0 +1,344 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Describes a .proto file, including everything defined within.
+ /// IDescriptor is implemented such that the File property returns this descriptor,
+ /// and the FullName is the same as the Name.
+ /// </summary>
+ public sealed class FileDescriptor : IDescriptor
+ {
+ private FileDescriptor(ByteString descriptorData, FileDescriptorProto proto, FileDescriptor[] dependencies, DescriptorPool pool, bool allowUnknownDependencies, GeneratedClrTypeInfo generatedCodeInfo)
+ {
+ SerializedData = descriptorData;
+ DescriptorPool = pool;
+ Proto = proto;
+ Dependencies = new ReadOnlyCollection<FileDescriptor>((FileDescriptor[]) dependencies.Clone());
+
+ PublicDependencies = DeterminePublicDependencies(this, proto, dependencies, allowUnknownDependencies);
+
+ pool.AddPackage(Package, this);
+
+ MessageTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.MessageType,
+ (message, index) =>
+ new MessageDescriptor(message, this, null, index, generatedCodeInfo.NestedTypes[index]));
+
+ EnumTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.EnumType,
+ (enumType, index) =>
+ new EnumDescriptor(enumType, this, null, index, generatedCodeInfo.NestedEnums[index]));
+
+ Services = DescriptorUtil.ConvertAndMakeReadOnly(proto.Service,
+ (service, index) =>
+ new ServiceDescriptor(service, this, index));
+ }
+
+ /// <summary>
+ /// Computes the full name of a descriptor within this file, with an optional parent message.
+ /// </summary>
+ internal string ComputeFullName(MessageDescriptor parent, string name)
+ {
+ if (parent != null)
+ {
+ return parent.FullName + "." + name;
+ }
+ if (Package.Length > 0)
+ {
+ return Package + "." + name;
+ }
+ return name;
+ }
+
+ /// <summary>
+ /// Extracts public dependencies from direct dependencies. This is a static method despite its
+ /// first parameter, as the value we're in the middle of constructing is only used for exceptions.
+ /// </summary>
+ private static IList<FileDescriptor> DeterminePublicDependencies(FileDescriptor @this, FileDescriptorProto proto, FileDescriptor[] dependencies, bool allowUnknownDependencies)
+ {
+ var nameToFileMap = new Dictionary<string, FileDescriptor>();
+ foreach (var file in dependencies)
+ {
+ nameToFileMap[file.Name] = file;
+ }
+ var publicDependencies = new List<FileDescriptor>();
+ for (int i = 0; i < proto.PublicDependency.Count; i++)
+ {
+ int index = proto.PublicDependency[i];
+ if (index < 0 || index >= proto.Dependency.Count)
+ {
+ throw new DescriptorValidationException(@this, "Invalid public dependency index.");
+ }
+ string name = proto.Dependency[index];
+ FileDescriptor file = nameToFileMap[name];
+ if (file == null)
+ {
+ if (!allowUnknownDependencies)
+ {
+ throw new DescriptorValidationException(@this, "Invalid public dependency: " + name);
+ }
+ // Ignore unknown dependencies.
+ }
+ else
+ {
+ publicDependencies.Add(file);
+ }
+ }
+ return new ReadOnlyCollection<FileDescriptor>(publicDependencies);
+ }
+
+ /// <value>
+ /// The descriptor in its protocol message representation.
+ /// </value>
+ internal FileDescriptorProto Proto { get; }
+
+ /// <value>
+ /// The file name.
+ /// </value>
+ public string Name => Proto.Name;
+
+ /// <summary>
+ /// The package as declared in the .proto file. This may or may not
+ /// be equivalent to the .NET namespace of the generated classes.
+ /// </summary>
+ public string Package => Proto.Package;
+
+ /// <value>
+ /// Unmodifiable list of top-level message types declared in this file.
+ /// </value>
+ public IList<MessageDescriptor> MessageTypes { get; }
+
+ /// <value>
+ /// Unmodifiable list of top-level enum types declared in this file.
+ /// </value>
+ public IList<EnumDescriptor> EnumTypes { get; }
+
+ /// <value>
+ /// Unmodifiable list of top-level services declared in this file.
+ /// </value>
+ public IList<ServiceDescriptor> Services { get; }
+
+ /// <value>
+ /// Unmodifiable list of this file's dependencies (imports).
+ /// </value>
+ public IList<FileDescriptor> Dependencies { get; }
+
+ /// <value>
+ /// Unmodifiable list of this file's public dependencies (public imports).
+ /// </value>
+ public IList<FileDescriptor> PublicDependencies { get; }
+
+ /// <value>
+ /// The original serialized binary form of this descriptor.
+ /// </value>
+ public ByteString SerializedData { get; }
+
+ /// <value>
+ /// Implementation of IDescriptor.FullName - just returns the same as Name.
+ /// </value>
+ string IDescriptor.FullName => Name;
+
+ /// <value>
+ /// Implementation of IDescriptor.File - just returns this descriptor.
+ /// </value>
+ FileDescriptor IDescriptor.File => this;
+
+ /// <value>
+ /// Pool containing symbol descriptors.
+ /// </value>
+ internal DescriptorPool DescriptorPool { get; }
+
+ /// <summary>
+ /// Finds a type (message, enum, service or extension) in the file by name. Does not find nested types.
+ /// </summary>
+ /// <param name="name">The unqualified type name to look for.</param>
+ /// <typeparam name="T">The type of descriptor to look for</typeparam>
+ /// <returns>The type's descriptor, or null if not found.</returns>
+ public T FindTypeByName<T>(String name)
+ where T : class, IDescriptor
+ {
+ // Don't allow looking up nested types. This will make optimization
+ // easier later.
+ if (name.IndexOf('.') != -1)
+ {
+ return null;
+ }
+ if (Package.Length > 0)
+ {
+ name = Package + "." + name;
+ }
+ T result = DescriptorPool.FindSymbol<T>(name);
+ if (result != null && result.File == this)
+ {
+ return result;
+ }
+ return null;
+ }
+
+ /// <summary>
+ /// Builds a FileDescriptor from its protocol buffer representation.
+ /// </summary>
+ /// <param name="descriptorData">The original serialized descriptor data.
+ /// We have only limited proto2 support, so serializing FileDescriptorProto
+ /// would not necessarily give us this.</param>
+ /// <param name="proto">The protocol message form of the FileDescriptor.</param>
+ /// <param name="dependencies">FileDescriptors corresponding to all of the
+ /// file's dependencies, in the exact order listed in the .proto file. May be null,
+ /// in which case it is treated as an empty array.</param>
+ /// <param name="allowUnknownDependencies">Whether unknown dependencies are ignored (true) or cause an exception to be thrown (false).</param>
+ /// <param name="generatedCodeInfo">Details about generated code, for the purposes of reflection.</param>
+ /// <exception cref="DescriptorValidationException">If <paramref name="proto"/> is not
+ /// a valid descriptor. This can occur for a number of reasons, such as a field
+ /// having an undefined type or because two messages were defined with the same name.</exception>
+ private static FileDescriptor BuildFrom(ByteString descriptorData, FileDescriptorProto proto, FileDescriptor[] dependencies, bool allowUnknownDependencies, GeneratedClrTypeInfo generatedCodeInfo)
+ {
+ // Building descriptors involves two steps: translating and linking.
+ // In the translation step (implemented by FileDescriptor's
+ // constructor), we build an object tree mirroring the
+ // FileDescriptorProto's tree and put all of the descriptors into the
+ // DescriptorPool's lookup tables. In the linking step, we look up all
+ // type references in the DescriptorPool, so that, for example, a
+ // FieldDescriptor for an embedded message contains a pointer directly
+ // to the Descriptor for that message's type. We also detect undefined
+ // types in the linking step.
+ if (dependencies == null)
+ {
+ dependencies = new FileDescriptor[0];
+ }
+
+ DescriptorPool pool = new DescriptorPool(dependencies);
+ FileDescriptor result = new FileDescriptor(descriptorData, proto, dependencies, pool, allowUnknownDependencies, generatedCodeInfo);
+
+ // Validate that the dependencies we've been passed (as FileDescriptors) are actually the ones we
+ // need.
+ if (dependencies.Length != proto.Dependency.Count)
+ {
+ throw new DescriptorValidationException(
+ result,
+ "Dependencies passed to FileDescriptor.BuildFrom() don't match " +
+ "those listed in the FileDescriptorProto.");
+ }
+ for (int i = 0; i < proto.Dependency.Count; i++)
+ {
+ if (dependencies[i].Name != proto.Dependency[i])
+ {
+ throw new DescriptorValidationException(
+ result,
+ "Dependencies passed to FileDescriptor.BuildFrom() don't match " +
+ "those listed in the FileDescriptorProto. Expected: " +
+ proto.Dependency[i] + " but was: " + dependencies[i].Name);
+ }
+ }
+
+ result.CrossLink();
+ return result;
+ }
+
+ private void CrossLink()
+ {
+ foreach (MessageDescriptor message in MessageTypes)
+ {
+ message.CrossLink();
+ }
+
+ foreach (ServiceDescriptor service in Services)
+ {
+ service.CrossLink();
+ }
+ }
+
+ /// <summary>
+ /// Creates a descriptor for generated code.
+ /// </summary>
+ /// <remarks>
+ /// This method is only designed to be used by the results of generating code with protoc,
+ /// which creates the appropriate dependencies etc. It has to be public because the generated
+ /// code is "external", but should not be called directly by end users.
+ /// </remarks>
+ public static FileDescriptor FromGeneratedCode(
+ byte[] descriptorData,
+ FileDescriptor[] dependencies,
+ GeneratedClrTypeInfo generatedCodeInfo)
+ {
+ FileDescriptorProto proto;
+ try
+ {
+ proto = FileDescriptorProto.Parser.ParseFrom(descriptorData);
+ }
+ catch (InvalidProtocolBufferException e)
+ {
+ throw new ArgumentException("Failed to parse protocol buffer descriptor for generated code.", e);
+ }
+
+ try
+ {
+ // When building descriptors for generated code, we allow unknown
+ // dependencies by default.
+ return BuildFrom(ByteString.CopyFrom(descriptorData), proto, dependencies, true, generatedCodeInfo);
+ }
+ catch (DescriptorValidationException e)
+ {
+ throw new ArgumentException($"Invalid embedded descriptor for \"{proto.Name}\".", e);
+ }
+ }
+
+ /// <summary>
+ /// Returns a <see cref="System.String" /> that represents this instance.
+ /// </summary>
+ /// <returns>
+ /// A <see cref="System.String" /> that represents this instance.
+ /// </returns>
+ public override string ToString()
+ {
+ return $"FileDescriptor for {Name}";
+ }
+
+ /// <summary>
+ /// Returns the file descriptor for descriptor.proto.
+ /// </summary>
+ /// <remarks>
+ /// This is used for protos which take a direct dependency on <c>descriptor.proto</c>, typically for
+ /// annotations. While <c>descriptor.proto</c> is a proto2 file, it is built into the Google.Protobuf
+ /// runtime for reflection purposes. The messages are internal to the runtime as they would require
+ /// proto2 semantics for full support, but the file descriptor is available via this property. The
+ /// C# codegen in protoc automatically uses this property when it detects a dependency on <c>descriptor.proto</c>.
+ /// </remarks>
+ /// <value>
+ /// The file descriptor for <c>descriptor.proto</c>.
+ /// </value>
+ public static FileDescriptor DescriptorProtoFileDescriptor { get { return DescriptorReflection.Descriptor; } }
+ }
+} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Reflection/GeneratedClrTypeInfo.cs b/csharp/src/Google.Protobuf/Reflection/GeneratedClrTypeInfo.cs
new file mode 100644
index 00000000..fe5db656
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/GeneratedClrTypeInfo.cs
@@ -0,0 +1,103 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2015 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+using System;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Extra information provided by generated code when initializing a message or file descriptor.
+ /// These are constructed as required, and are not long-lived. Hand-written code should
+ /// never need to use this type.
+ /// </summary>
+ public sealed class GeneratedClrTypeInfo
+ {
+ private static readonly string[] EmptyNames = new string[0];
+ private static readonly GeneratedClrTypeInfo[] EmptyCodeInfo = new GeneratedClrTypeInfo[0];
+
+ /// <summary>
+ /// Irrelevant for file descriptors; the CLR type for the message for message descriptors.
+ /// </summary>
+ public Type ClrType { get; private set; }
+
+ /// <summary>
+ /// Irrelevant for file descriptors; the parser for message descriptors.
+ /// </summary>
+ public MessageParser Parser { get; }
+
+ /// <summary>
+ /// Irrelevant for file descriptors; the CLR property names (in message descriptor field order)
+ /// for fields in the message for message descriptors.
+ /// </summary>
+ public string[] PropertyNames { get; }
+
+ /// <summary>
+ /// Irrelevant for file descriptors; the CLR property "base" names (in message descriptor oneof order)
+ /// for oneofs in the message for message descriptors. It is expected that for a oneof name of "Foo",
+ /// there will be a "FooCase" property and a "ClearFoo" method.
+ /// </summary>
+ public string[] OneofNames { get; }
+
+ /// <summary>
+ /// The reflection information for types within this file/message descriptor. Elements may be null
+ /// if there is no corresponding generated type, e.g. for map entry types.
+ /// </summary>
+ public GeneratedClrTypeInfo[] NestedTypes { get; }
+
+ /// <summary>
+ /// The CLR types for enums within this file/message descriptor.
+ /// </summary>
+ public Type[] NestedEnums { get; }
+
+ /// <summary>
+ /// Creates a GeneratedClrTypeInfo for a message descriptor, with nested types, nested enums, the CLR type, property names and oneof names.
+ /// Each array parameter may be null, to indicate a lack of values.
+ /// The parameter order is designed to make it feasible to format the generated code readably.
+ /// </summary>
+ public GeneratedClrTypeInfo(Type clrType, MessageParser parser, string[] propertyNames, string[] oneofNames, Type[] nestedEnums, GeneratedClrTypeInfo[] nestedTypes)
+ {
+ NestedTypes = nestedTypes ?? EmptyCodeInfo;
+ NestedEnums = nestedEnums ?? ReflectionUtil.EmptyTypes;
+ ClrType = clrType;
+ Parser = parser;
+ PropertyNames = propertyNames ?? EmptyNames;
+ OneofNames = oneofNames ?? EmptyNames;
+ }
+
+ /// <summary>
+ /// Creates a GeneratedClrTypeInfo for a file descriptor, with only types and enums.
+ /// </summary>
+ public GeneratedClrTypeInfo(Type[] nestedEnums, GeneratedClrTypeInfo[] nestedTypes)
+ : this(null, null, null, null, nestedEnums, nestedTypes)
+ {
+ }
+ }
+} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Reflection/IDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/IDescriptor.cs
new file mode 100644
index 00000000..318d58c9
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/IDescriptor.cs
@@ -0,0 +1,55 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Interface implemented by all descriptor types.
+ /// </summary>
+ public interface IDescriptor
+ {
+ /// <summary>
+ /// Returns the name of the entity (message, field etc) being described.
+ /// </summary>
+ string Name { get; }
+
+ /// <summary>
+ /// Returns the fully-qualified name of the entity being described.
+ /// </summary>
+ string FullName { get; }
+
+ /// <summary>
+ /// Returns the descriptor for the .proto file that this entity is part of.
+ /// </summary>
+ FileDescriptor File { get; }
+ }
+} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs b/csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs
new file mode 100644
index 00000000..cfe56fde
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs
@@ -0,0 +1,71 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using System;
+using System.Collections;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Allows fields to be reflectively accessed.
+ /// </summary>
+ public interface IFieldAccessor
+ {
+ /// <summary>
+ /// Returns the descriptor associated with this field.
+ /// </summary>
+ FieldDescriptor Descriptor { get; }
+
+ /// <summary>
+ /// Clears the field in the specified message. (For repeated fields,
+ /// this clears the list.)
+ /// </summary>
+ void Clear(IMessage message);
+
+ /// <summary>
+ /// Fetches the field value. For repeated values, this will be an
+ /// <see cref="IList"/> implementation. For map values, this will be an
+ /// <see cref="IDictionary"/> implementation.
+ /// </summary>
+ object GetValue(IMessage message);
+
+ /// <summary>
+ /// Mutator for single "simple" fields only.
+ /// </summary>
+ /// <remarks>
+ /// Repeated fields are mutated by fetching the value and manipulating it as a list.
+ /// Map fields are mutated by fetching the value and manipulating it as a dictionary.
+ /// </remarks>
+ /// <exception cref="InvalidOperationException">The field is not a "simple" field.</exception>
+ void SetValue(IMessage message, object value);
+ }
+} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Reflection/MapFieldAccessor.cs b/csharp/src/Google.Protobuf/Reflection/MapFieldAccessor.cs
new file mode 100644
index 00000000..9ed7f8c4
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/MapFieldAccessor.cs
@@ -0,0 +1,59 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2015 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Accessor for map fields.
+ /// </summary>
+ internal sealed class MapFieldAccessor : FieldAccessorBase
+ {
+ internal MapFieldAccessor(PropertyInfo property, FieldDescriptor descriptor) : base(property, descriptor)
+ {
+ }
+
+ public override void Clear(IMessage message)
+ {
+ IDictionary list = (IDictionary) GetValue(message);
+ list.Clear();
+ }
+
+ public override void SetValue(IMessage message, object value)
+ {
+ throw new InvalidOperationException("SetValue is not implemented for map fields");
+ }
+ }
+}
diff --git a/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs
new file mode 100644
index 00000000..7a1cb9d5
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs
@@ -0,0 +1,321 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+#if DOTNET35
+// Needed for ReadOnlyDictionary, which does not exist in .NET 3.5
+using Google.Protobuf.Collections;
+#endif
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Describes a message type.
+ /// </summary>
+ public sealed class MessageDescriptor : DescriptorBase
+ {
+ private static readonly HashSet<string> WellKnownTypeNames = new HashSet<string>
+ {
+ "google/protobuf/any.proto",
+ "google/protobuf/api.proto",
+ "google/protobuf/duration.proto",
+ "google/protobuf/empty.proto",
+ "google/protobuf/wrappers.proto",
+ "google/protobuf/timestamp.proto",
+ "google/protobuf/field_mask.proto",
+ "google/protobuf/source_context.proto",
+ "google/protobuf/struct.proto",
+ "google/protobuf/type.proto",
+ };
+
+ private readonly IList<FieldDescriptor> fieldsInDeclarationOrder;
+ private readonly IList<FieldDescriptor> fieldsInNumberOrder;
+ private readonly IDictionary<string, FieldDescriptor> jsonFieldMap;
+
+ internal MessageDescriptor(DescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int typeIndex, GeneratedClrTypeInfo generatedCodeInfo)
+ : base(file, file.ComputeFullName(parent, proto.Name), typeIndex)
+ {
+ Proto = proto;
+ Parser = generatedCodeInfo?.Parser;
+ ClrType = generatedCodeInfo?.ClrType;
+ ContainingType = parent;
+
+ // Note use of generatedCodeInfo. rather than generatedCodeInfo?. here... we don't expect
+ // to see any nested oneofs, types or enums in "not actually generated" code... we do
+ // expect fields though (for map entry messages).
+ Oneofs = DescriptorUtil.ConvertAndMakeReadOnly(
+ proto.OneofDecl,
+ (oneof, index) =>
+ new OneofDescriptor(oneof, file, this, index, generatedCodeInfo.OneofNames[index]));
+
+ NestedTypes = DescriptorUtil.ConvertAndMakeReadOnly(
+ proto.NestedType,
+ (type, index) =>
+ new MessageDescriptor(type, file, this, index, generatedCodeInfo.NestedTypes[index]));
+
+ EnumTypes = DescriptorUtil.ConvertAndMakeReadOnly(
+ proto.EnumType,
+ (type, index) =>
+ new EnumDescriptor(type, file, this, index, generatedCodeInfo.NestedEnums[index]));
+
+ fieldsInDeclarationOrder = DescriptorUtil.ConvertAndMakeReadOnly(
+ proto.Field,
+ (field, index) =>
+ new FieldDescriptor(field, file, this, index, generatedCodeInfo?.PropertyNames[index]));
+ fieldsInNumberOrder = new ReadOnlyCollection<FieldDescriptor>(fieldsInDeclarationOrder.OrderBy(field => field.FieldNumber).ToArray());
+ // TODO: Use field => field.Proto.JsonName when we're confident it's appropriate. (And then use it in the formatter, too.)
+ jsonFieldMap = CreateJsonFieldMap(fieldsInNumberOrder);
+ file.DescriptorPool.AddSymbol(this);
+ Fields = new FieldCollection(this);
+ }
+
+ private static ReadOnlyDictionary<string, FieldDescriptor> CreateJsonFieldMap(IList<FieldDescriptor> fields)
+ {
+ var map = new Dictionary<string, FieldDescriptor>();
+ foreach (var field in fields)
+ {
+ map[field.Name] = field;
+ map[field.JsonName] = field;
+ }
+ return new ReadOnlyDictionary<string, FieldDescriptor>(map);
+ }
+
+ /// <summary>
+ /// The brief name of the descriptor's target.
+ /// </summary>
+ public override string Name => Proto.Name;
+
+ internal DescriptorProto Proto { get; }
+
+ /// <summary>
+ /// The CLR type used to represent message instances from this descriptor.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// The value returned by this property will be non-null for all regular fields. However,
+ /// if a message containing a map field is introspected, the list of nested messages will include
+ /// an auto-generated nested key/value pair message for the field. This is not represented in any
+ /// generated type, so this property will return null in such cases.
+ /// </para>
+ /// <para>
+ /// For wrapper types (<see cref="Google.Protobuf.WellKnownTypes.StringValue"/> and the like), the type returned here
+ /// will be the generated message type, not the native type used by reflection for fields of those types. Code
+ /// using reflection should call <see cref="IsWrapperType"/> to determine whether a message descriptor represents
+ /// a wrapper type, and handle the result appropriately.
+ /// </para>
+ /// </remarks>
+ public Type ClrType { get; }
+
+ /// <summary>
+ /// A parser for this message type.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// As <see cref="MessageDescriptor"/> is not generic, this cannot be statically
+ /// typed to the relevant type, but it should produce objects of a type compatible with <see cref="ClrType"/>.
+ /// </para>
+ /// <para>
+ /// The value returned by this property will be non-null for all regular fields. However,
+ /// if a message containing a map field is introspected, the list of nested messages will include
+ /// an auto-generated nested key/value pair message for the field. No message parser object is created for
+ /// such messages, so this property will return null in such cases.
+ /// </para>
+ /// <para>
+ /// For wrapper types (<see cref="Google.Protobuf.WellKnownTypes.StringValue"/> and the like), the parser returned here
+ /// will be the generated message type, not the native type used by reflection for fields of those types. Code
+ /// using reflection should call <see cref="IsWrapperType"/> to determine whether a message descriptor represents
+ /// a wrapper type, and handle the result appropriately.
+ /// </para>
+ /// </remarks>
+ public MessageParser Parser { get; }
+
+ /// <summary>
+ /// Returns whether this message is one of the "well known types" which may have runtime/protoc support.
+ /// </summary>
+ internal bool IsWellKnownType => File.Package == "google.protobuf" && WellKnownTypeNames.Contains(File.Name);
+
+ /// <summary>
+ /// Returns whether this message is one of the "wrapper types" used for fields which represent primitive values
+ /// with the addition of presence.
+ /// </summary>
+ internal bool IsWrapperType => File.Package == "google.protobuf" && File.Name == "google/protobuf/wrappers.proto";
+
+ /// <value>
+ /// If this is a nested type, get the outer descriptor, otherwise null.
+ /// </value>
+ public MessageDescriptor ContainingType { get; }
+
+ /// <value>
+ /// A collection of fields, which can be retrieved by name or field number.
+ /// </value>
+ public FieldCollection Fields { get; }
+
+ /// <value>
+ /// An unmodifiable list of this message type's nested types.
+ /// </value>
+ public IList<MessageDescriptor> NestedTypes { get; }
+
+ /// <value>
+ /// An unmodifiable list of this message type's enum types.
+ /// </value>
+ public IList<EnumDescriptor> EnumTypes { get; }
+
+ /// <value>
+ /// An unmodifiable list of the "oneof" field collections in this message type.
+ /// </value>
+ public IList<OneofDescriptor> Oneofs { get; }
+
+ /// <summary>
+ /// Finds a field by field name.
+ /// </summary>
+ /// <param name="name">The unqualified name of the field (e.g. "foo").</param>
+ /// <returns>The field's descriptor, or null if not found.</returns>
+ public FieldDescriptor FindFieldByName(String name) => File.DescriptorPool.FindSymbol<FieldDescriptor>(FullName + "." + name);
+
+ /// <summary>
+ /// Finds a field by field number.
+ /// </summary>
+ /// <param name="number">The field number within this message type.</param>
+ /// <returns>The field's descriptor, or null if not found.</returns>
+ public FieldDescriptor FindFieldByNumber(int number) => File.DescriptorPool.FindFieldByNumber(this, number);
+
+ /// <summary>
+ /// Finds a nested descriptor by name. The is valid for fields, nested
+ /// message types, oneofs and enums.
+ /// </summary>
+ /// <param name="name">The unqualified name of the descriptor, e.g. "Foo"</param>
+ /// <returns>The descriptor, or null if not found.</returns>
+ public T FindDescriptor<T>(string name) where T : class, IDescriptor =>
+ File.DescriptorPool.FindSymbol<T>(FullName + "." + name);
+
+ /// <summary>
+ /// Looks up and cross-links all fields and nested types.
+ /// </summary>
+ internal void CrossLink()
+ {
+ foreach (MessageDescriptor message in NestedTypes)
+ {
+ message.CrossLink();
+ }
+
+ foreach (FieldDescriptor field in fieldsInDeclarationOrder)
+ {
+ field.CrossLink();
+ }
+
+ foreach (OneofDescriptor oneof in Oneofs)
+ {
+ oneof.CrossLink();
+ }
+ }
+
+ /// <summary>
+ /// A collection to simplify retrieving the field accessor for a particular field.
+ /// </summary>
+ public sealed class FieldCollection
+ {
+ private readonly MessageDescriptor messageDescriptor;
+
+ internal FieldCollection(MessageDescriptor messageDescriptor)
+ {
+ this.messageDescriptor = messageDescriptor;
+ }
+
+ /// <value>
+ /// Returns the fields in the message as an immutable list, in the order in which they
+ /// are declared in the source .proto file.
+ /// </value>
+ public IList<FieldDescriptor> InDeclarationOrder() => messageDescriptor.fieldsInDeclarationOrder;
+
+ /// <value>
+ /// Returns the fields in the message as an immutable list, in ascending field number
+ /// order. Field numbers need not be contiguous, so there is no direct mapping from the
+ /// index in the list to the field number; to retrieve a field by field number, it is better
+ /// to use the <see cref="FieldCollection"/> indexer.
+ /// </value>
+ public IList<FieldDescriptor> InFieldNumberOrder() => messageDescriptor.fieldsInNumberOrder;
+
+ // TODO: consider making this public in the future. (Being conservative for now...)
+
+ /// <value>
+ /// Returns a read-only dictionary mapping the field names in this message as they're available
+ /// in the JSON representation to the field descriptors. For example, a field <c>foo_bar</c>
+ /// in the message would result two entries, one with a key <c>fooBar</c> and one with a key
+ /// <c>foo_bar</c>, both referring to the same field.
+ /// </value>
+ internal IDictionary<string, FieldDescriptor> ByJsonName() => messageDescriptor.jsonFieldMap;
+
+ /// <summary>
+ /// Retrieves the descriptor for the field with the given number.
+ /// </summary>
+ /// <param name="number">Number of the field to retrieve the descriptor for</param>
+ /// <returns>The accessor for the given field</returns>
+ /// <exception cref="KeyNotFoundException">The message descriptor does not contain a field
+ /// with the given number</exception>
+ public FieldDescriptor this[int number]
+ {
+ get
+ {
+ var fieldDescriptor = messageDescriptor.FindFieldByNumber(number);
+ if (fieldDescriptor == null)
+ {
+ throw new KeyNotFoundException("No such field number");
+ }
+ return fieldDescriptor;
+ }
+ }
+
+ /// <summary>
+ /// Retrieves the descriptor for the field with the given name.
+ /// </summary>
+ /// <param name="name">Name of the field to retrieve the descriptor for</param>
+ /// <returns>The descriptor for the given field</returns>
+ /// <exception cref="KeyNotFoundException">The message descriptor does not contain a field
+ /// with the given name</exception>
+ public FieldDescriptor this[string name]
+ {
+ get
+ {
+ var fieldDescriptor = messageDescriptor.FindFieldByName(name);
+ if (fieldDescriptor == null)
+ {
+ throw new KeyNotFoundException("No such field name");
+ }
+ return fieldDescriptor;
+ }
+ }
+ }
+ }
+}
diff --git a/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs
new file mode 100644
index 00000000..f9539f6c
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs
@@ -0,0 +1,103 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Describes a single method in a service.
+ /// </summary>
+ public sealed class MethodDescriptor : DescriptorBase
+ {
+ private readonly MethodDescriptorProto proto;
+ private readonly ServiceDescriptor service;
+ private MessageDescriptor inputType;
+ private MessageDescriptor outputType;
+
+ /// <value>
+ /// The service this method belongs to.
+ /// </value>
+ public ServiceDescriptor Service { get { return service; } }
+
+ /// <value>
+ /// The method's input type.
+ /// </value>
+ public MessageDescriptor InputType { get { return inputType; } }
+
+ /// <value>
+ /// The method's input type.
+ /// </value>
+ public MessageDescriptor OutputType { get { return outputType; } }
+
+ /// <value>
+ /// Indicates if client streams multiple requests.
+ /// </value>
+ public bool IsClientStreaming { get { return proto.ClientStreaming; } }
+
+ /// <value>
+ /// Indicates if server streams multiple responses.
+ /// </value>
+ public bool IsServerStreaming { get { return proto.ServerStreaming; } }
+
+ internal MethodDescriptor(MethodDescriptorProto proto, FileDescriptor file,
+ ServiceDescriptor parent, int index)
+ : base(file, parent.FullName + "." + proto.Name, index)
+ {
+ this.proto = proto;
+ service = parent;
+ file.DescriptorPool.AddSymbol(this);
+ }
+
+ internal MethodDescriptorProto Proto { get { return proto; } }
+
+ /// <summary>
+ /// The brief name of the descriptor's target.
+ /// </summary>
+ public override string Name { get { return proto.Name; } }
+
+ internal void CrossLink()
+ {
+ IDescriptor lookup = File.DescriptorPool.LookupSymbol(Proto.InputType, this);
+ if (!(lookup is MessageDescriptor))
+ {
+ throw new DescriptorValidationException(this, "\"" + Proto.InputType + "\" is not a message type.");
+ }
+ inputType = (MessageDescriptor) lookup;
+
+ lookup = File.DescriptorPool.LookupSymbol(Proto.OutputType, this);
+ if (!(lookup is MessageDescriptor))
+ {
+ throw new DescriptorValidationException(this, "\"" + Proto.OutputType + "\" is not a message type.");
+ }
+ outputType = (MessageDescriptor) lookup;
+ }
+ }
+} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Reflection/OneofAccessor.cs b/csharp/src/Google.Protobuf/Reflection/OneofAccessor.cs
new file mode 100644
index 00000000..8714ab18
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/OneofAccessor.cs
@@ -0,0 +1,90 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2015 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using System;
+using System.Reflection;
+using Google.Protobuf.Compatibility;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Reflection access for a oneof, allowing clear and "get case" actions.
+ /// </summary>
+ public sealed class OneofAccessor
+ {
+ private readonly Func<IMessage, int> caseDelegate;
+ private readonly Action<IMessage> clearDelegate;
+ private OneofDescriptor descriptor;
+
+ internal OneofAccessor(PropertyInfo caseProperty, MethodInfo clearMethod, OneofDescriptor descriptor)
+ {
+ if (!caseProperty.CanRead)
+ {
+ throw new ArgumentException("Cannot read from property");
+ }
+ this.descriptor = descriptor;
+ caseDelegate = ReflectionUtil.CreateFuncIMessageT<int>(caseProperty.GetGetMethod());
+
+ this.descriptor = descriptor;
+ clearDelegate = ReflectionUtil.CreateActionIMessage(clearMethod);
+ }
+
+ /// <summary>
+ /// Gets the descriptor for this oneof.
+ /// </summary>
+ /// <value>
+ /// The descriptor of the oneof.
+ /// </value>
+ public OneofDescriptor Descriptor { get { return descriptor; } }
+
+ /// <summary>
+ /// Clears the oneof in the specified message.
+ /// </summary>
+ public void Clear(IMessage message)
+ {
+ clearDelegate(message);
+ }
+
+ /// <summary>
+ /// Indicates which field in the oneof is set for specified message
+ /// </summary>
+ public FieldDescriptor GetCaseFieldDescriptor(IMessage message)
+ {
+ int fieldNumber = caseDelegate(message);
+ if (fieldNumber > 0)
+ {
+ return descriptor.ContainingType.FindFieldByNumber(fieldNumber);
+ }
+ return null;
+ }
+ }
+}
diff --git a/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs
new file mode 100644
index 00000000..22020acf
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs
@@ -0,0 +1,122 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2015 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using Google.Protobuf.Compatibility;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Describes a "oneof" field collection in a message type: a set of
+ /// fields of which at most one can be set in any particular message.
+ /// </summary>
+ public sealed class OneofDescriptor : DescriptorBase
+ {
+ private readonly OneofDescriptorProto proto;
+ private MessageDescriptor containingType;
+ private IList<FieldDescriptor> fields;
+ private readonly OneofAccessor accessor;
+
+ internal OneofDescriptor(OneofDescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int index, string clrName)
+ : base(file, file.ComputeFullName(parent, proto.Name), index)
+ {
+ this.proto = proto;
+ containingType = parent;
+
+ file.DescriptorPool.AddSymbol(this);
+ accessor = CreateAccessor(clrName);
+ }
+
+ /// <summary>
+ /// The brief name of the descriptor's target.
+ /// </summary>
+ public override string Name { get { return proto.Name; } }
+
+ /// <summary>
+ /// Gets the message type containing this oneof.
+ /// </summary>
+ /// <value>
+ /// The message type containing this oneof.
+ /// </value>
+ public MessageDescriptor ContainingType
+ {
+ get { return containingType; }
+ }
+
+ /// <summary>
+ /// Gets the fields within this oneof, in declaration order.
+ /// </summary>
+ /// <value>
+ /// The fields within this oneof, in declaration order.
+ /// </value>
+ public IList<FieldDescriptor> Fields { get { return fields; } }
+
+ /// <summary>
+ /// Gets an accessor for reflective access to the values associated with the oneof
+ /// in a particular message.
+ /// </summary>
+ /// <value>
+ /// The accessor used for reflective access.
+ /// </value>
+ public OneofAccessor Accessor { get { return accessor; } }
+
+ internal void CrossLink()
+ {
+ List<FieldDescriptor> fieldCollection = new List<FieldDescriptor>();
+ foreach (var field in ContainingType.Fields.InDeclarationOrder())
+ {
+ if (field.ContainingOneof == this)
+ {
+ fieldCollection.Add(field);
+ }
+ }
+ fields = new ReadOnlyCollection<FieldDescriptor>(fieldCollection);
+ }
+
+ private OneofAccessor CreateAccessor(string clrName)
+ {
+ var caseProperty = containingType.ClrType.GetProperty(clrName + "Case");
+ if (caseProperty == null)
+ {
+ throw new DescriptorValidationException(this, $"Property {clrName}Case not found in {containingType.ClrType}");
+ }
+ var clearMethod = containingType.ClrType.GetMethod("Clear" + clrName);
+ if (clearMethod == null)
+ {
+ throw new DescriptorValidationException(this, $"Method Clear{clrName} not found in {containingType.ClrType}");
+ }
+
+ return new OneofAccessor(caseProperty, clearMethod, this);
+ }
+ }
+}
diff --git a/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs b/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs
new file mode 100644
index 00000000..27f9ab98
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs
@@ -0,0 +1,58 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using System;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Specifies the original name (in the .proto file) of a named element,
+ /// such as an enum value.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Field)]
+ public class OriginalNameAttribute : Attribute
+ {
+ /// <summary>
+ /// The name of the element in the .proto file.
+ /// </summary>
+ public string Name { get; set; }
+
+ /// <summary>
+ /// Constructs a new attribute instance for the given name.
+ /// </summary>
+ /// <param name="name">The name of the element in the .proto file.</param>
+ public OriginalNameAttribute(string name)
+ {
+ Name = ProtoPreconditions.CheckNotNull(name, nameof(name));
+ }
+ }
+} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs
new file mode 100644
index 00000000..e547d834
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs
@@ -0,0 +1,68 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Represents a package in the symbol table. We use PackageDescriptors
+ /// just as placeholders so that someone cannot define, say, a message type
+ /// that has the same name as an existing package.
+ /// </summary>
+ internal sealed class PackageDescriptor : IDescriptor
+ {
+ private readonly string name;
+ private readonly string fullName;
+ private readonly FileDescriptor file;
+
+ internal PackageDescriptor(string name, string fullName, FileDescriptor file)
+ {
+ this.file = file;
+ this.fullName = fullName;
+ this.name = name;
+ }
+
+ public string Name
+ {
+ get { return name; }
+ }
+
+ public string FullName
+ {
+ get { return fullName; }
+ }
+
+ public FileDescriptor File
+ {
+ get { return file; }
+ }
+ }
+} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Reflection/PartialClasses.cs b/csharp/src/Google.Protobuf/Reflection/PartialClasses.cs
new file mode 100644
index 00000000..8c055d6d
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/PartialClasses.cs
@@ -0,0 +1,59 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+// This file just contains partial classes for any autogenerated classes that need additional support.
+namespace Google.Protobuf.Reflection
+{
+ internal partial class FieldDescriptorProto
+ {
+ // We can't tell the difference between "explicitly set to 0" and "not set"
+ // in proto3, but we need to tell the difference for OneofIndex. descriptor.proto
+ // is really a proto2 file, but the runtime doesn't know about proto2 semantics...
+ // We fake it by defaulting to -1.
+ partial void OnConstruction()
+ {
+ OneofIndex = -1;
+ }
+ }
+
+ internal partial class FieldOptions
+ {
+ // We can't tell the difference between "explicitly set to false" and "not set"
+ // in proto3, but we need to tell the difference for FieldDescriptor.IsPacked.
+ // This won't work if we ever need to support proto2, but at that point we'll be
+ // able to remove this hack and use field presence instead.
+ partial void OnConstruction()
+ {
+ Packed = true;
+ }
+ }
+} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs b/csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs
new file mode 100644
index 00000000..df820ca3
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs
@@ -0,0 +1,107 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Reflection;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// The methods in this class are somewhat evil, and should not be tampered with lightly.
+ /// Basically they allow the creation of relatively weakly typed delegates from MethodInfos
+ /// which are more strongly typed. They do this by creating an appropriate strongly typed
+ /// delegate from the MethodInfo, and then calling that within an anonymous method.
+ /// Mind-bending stuff (at least to your humble narrator) but the resulting delegates are
+ /// very fast compared with calling Invoke later on.
+ /// </summary>
+ internal static class ReflectionUtil
+ {
+ /// <summary>
+ /// Empty Type[] used when calling GetProperty to force property instead of indexer fetching.
+ /// </summary>
+ internal static readonly Type[] EmptyTypes = new Type[0];
+
+ /// <summary>
+ /// Creates a delegate which will cast the argument to the appropriate method target type,
+ /// call the method on it, then convert the result to object.
+ /// </summary>
+ internal static Func<IMessage, object> CreateFuncIMessageObject(MethodInfo method)
+ {
+ ParameterExpression parameter = Expression.Parameter(typeof(IMessage), "p");
+ Expression downcast = Expression.Convert(parameter, method.DeclaringType);
+ Expression call = Expression.Call(downcast, method);
+ Expression upcast = Expression.Convert(call, typeof(object));
+ return Expression.Lambda<Func<IMessage, object>>(upcast, parameter).Compile();
+ }
+
+ /// <summary>
+ /// Creates a delegate which will cast the argument to the appropriate method target type,
+ /// call the method on it, then convert the result to the specified type.
+ /// </summary>
+ internal static Func<IMessage, T> CreateFuncIMessageT<T>(MethodInfo method)
+ {
+ ParameterExpression parameter = Expression.Parameter(typeof(IMessage), "p");
+ Expression downcast = Expression.Convert(parameter, method.DeclaringType);
+ Expression call = Expression.Call(downcast, method);
+ Expression upcast = Expression.Convert(call, typeof(T));
+ return Expression.Lambda<Func<IMessage, T>>(upcast, parameter).Compile();
+ }
+
+ /// <summary>
+ /// Creates a delegate which will execute the given method after casting the first argument to
+ /// the target type of the method, and the second argument to the first parameter type of the method.
+ /// </summary>
+ internal static Action<IMessage, object> CreateActionIMessageObject(MethodInfo method)
+ {
+ ParameterExpression targetParameter = Expression.Parameter(typeof(IMessage), "target");
+ ParameterExpression argParameter = Expression.Parameter(typeof(object), "arg");
+ Expression castTarget = Expression.Convert(targetParameter, method.DeclaringType);
+ Expression castArgument = Expression.Convert(argParameter, method.GetParameters()[0].ParameterType);
+ Expression call = Expression.Call(castTarget, method, castArgument);
+ return Expression.Lambda<Action<IMessage, object>>(call, targetParameter, argParameter).Compile();
+ }
+
+ /// <summary>
+ /// Creates a delegate which will execute the given method after casting the first argument to
+ /// the target type of the method.
+ /// </summary>
+ internal static Action<IMessage> CreateActionIMessage(MethodInfo method)
+ {
+ ParameterExpression targetParameter = Expression.Parameter(typeof(IMessage), "target");
+ Expression castTarget = Expression.Convert(targetParameter, method.DeclaringType);
+ Expression call = Expression.Call(castTarget, method);
+ return Expression.Lambda<Action<IMessage>>(call, targetParameter).Compile();
+ }
+ }
+} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Reflection/RepeatedFieldAccessor.cs b/csharp/src/Google.Protobuf/Reflection/RepeatedFieldAccessor.cs
new file mode 100644
index 00000000..bd408470
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/RepeatedFieldAccessor.cs
@@ -0,0 +1,60 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2015 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Accessor for repeated fields.
+ /// </summary>
+ internal sealed class RepeatedFieldAccessor : FieldAccessorBase
+ {
+ internal RepeatedFieldAccessor(PropertyInfo property, FieldDescriptor descriptor) : base(property, descriptor)
+ {
+ }
+
+ public override void Clear(IMessage message)
+ {
+ IList list = (IList) GetValue(message);
+ list.Clear();
+ }
+
+ public override void SetValue(IMessage message, object value)
+ {
+ throw new InvalidOperationException("SetValue is not implemented for repeated fields");
+ }
+
+ }
+}
diff --git a/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs
new file mode 100644
index 00000000..cc0a5010
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs
@@ -0,0 +1,89 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using System;
+using System.Collections.Generic;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Describes a service type.
+ /// </summary>
+ public sealed class ServiceDescriptor : DescriptorBase
+ {
+ private readonly ServiceDescriptorProto proto;
+ private readonly IList<MethodDescriptor> methods;
+
+ internal ServiceDescriptor(ServiceDescriptorProto proto, FileDescriptor file, int index)
+ : base(file, file.ComputeFullName(null, proto.Name), index)
+ {
+ this.proto = proto;
+ methods = DescriptorUtil.ConvertAndMakeReadOnly(proto.Method,
+ (method, i) => new MethodDescriptor(method, file, this, i));
+
+ file.DescriptorPool.AddSymbol(this);
+ }
+
+ /// <summary>
+ /// The brief name of the descriptor's target.
+ /// </summary>
+ public override string Name { get { return proto.Name; } }
+
+ internal ServiceDescriptorProto Proto { get { return proto; } }
+
+ /// <value>
+ /// An unmodifiable list of methods in this service.
+ /// </value>
+ public IList<MethodDescriptor> Methods
+ {
+ get { return methods; }
+ }
+
+ /// <summary>
+ /// Finds a method by name.
+ /// </summary>
+ /// <param name="name">The unqualified name of the method (e.g. "Foo").</param>
+ /// <returns>The method's decsriptor, or null if not found.</returns>
+ public MethodDescriptor FindMethodByName(String name)
+ {
+ return File.DescriptorPool.FindSymbol<MethodDescriptor>(FullName + "." + name);
+ }
+
+ internal void CrossLink()
+ {
+ foreach (MethodDescriptor method in methods)
+ {
+ method.CrossLink();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs b/csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs
new file mode 100644
index 00000000..bbac2173
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs
@@ -0,0 +1,81 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2015 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using System;
+using System.Reflection;
+using Google.Protobuf.Compatibility;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Accessor for single fields.
+ /// </summary>
+ internal sealed class SingleFieldAccessor : FieldAccessorBase
+ {
+ // All the work here is actually done in the constructor - it creates the appropriate delegates.
+ // There are various cases to consider, based on the property type (message, string/bytes, or "genuine" primitive)
+ // and proto2 vs proto3 for non-message types, as proto3 doesn't support "full" presence detection or default
+ // values.
+
+ private readonly Action<IMessage, object> setValueDelegate;
+ private readonly Action<IMessage> clearDelegate;
+
+ internal SingleFieldAccessor(PropertyInfo property, FieldDescriptor descriptor) : base(property, descriptor)
+ {
+ if (!property.CanWrite)
+ {
+ throw new ArgumentException("Not all required properties/methods available");
+ }
+ setValueDelegate = ReflectionUtil.CreateActionIMessageObject(property.GetSetMethod());
+
+ var clrType = property.PropertyType;
+
+ // TODO: Validate that this is a reasonable single field? (Should be a value type, a message type, or string/ByteString.)
+ object defaultValue =
+ descriptor.FieldType == FieldType.Message ? null
+ : clrType == typeof(string) ? ""
+ : clrType == typeof(ByteString) ? ByteString.Empty
+ : Activator.CreateInstance(clrType);
+ clearDelegate = message => SetValue(message, defaultValue);
+ }
+
+ public override void Clear(IMessage message)
+ {
+ clearDelegate(message);
+ }
+
+ public override void SetValue(IMessage message, object value)
+ {
+ setValueDelegate(message, value);
+ }
+ }
+}
diff --git a/csharp/src/Google.Protobuf/Reflection/TypeRegistry.cs b/csharp/src/Google.Protobuf/Reflection/TypeRegistry.cs
new file mode 100644
index 00000000..e94e3e6c
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/TypeRegistry.cs
@@ -0,0 +1,183 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2015 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// An immutable registry of types which can be looked up by their full name.
+ /// </summary>
+ public sealed class TypeRegistry
+ {
+ /// <summary>
+ /// An empty type registry, containing no types.
+ /// </summary>
+ public static TypeRegistry Empty { get; } = new TypeRegistry(new Dictionary<string, MessageDescriptor>());
+
+ private readonly Dictionary<string, MessageDescriptor> fullNameToMessageMap;
+
+ private TypeRegistry(Dictionary<string, MessageDescriptor> fullNameToMessageMap)
+ {
+ this.fullNameToMessageMap = fullNameToMessageMap;
+ }
+
+ /// <summary>
+ /// Attempts to find a message descriptor by its full name.
+ /// </summary>
+ /// <param name="fullName">The full name of the message, which is the dot-separated
+ /// combination of package, containing messages and message name</param>
+ /// <returns>The message descriptor corresponding to <paramref name="fullName"/> or null
+ /// if there is no such message descriptor.</returns>
+ public MessageDescriptor Find(string fullName)
+ {
+ MessageDescriptor ret;
+ // Ignore the return value as ret will end up with the right value either way.
+ fullNameToMessageMap.TryGetValue(fullName, out ret);
+ return ret;
+ }
+
+ /// <summary>
+ /// Creates a type registry from the specified set of file descriptors.
+ /// </summary>
+ /// <remarks>
+ /// This is a convenience overload for <see cref="FromFiles(IEnumerable{FileDescriptor})"/>
+ /// to allow calls such as <c>TypeRegistry.FromFiles(descriptor1, descriptor2)</c>.
+ /// </remarks>
+ /// <param name="fileDescriptors">The set of files to include in the registry. Must not contain null values.</param>
+ /// <returns>A type registry for the given files.</returns>
+ public static TypeRegistry FromFiles(params FileDescriptor[] fileDescriptors)
+ {
+ return FromFiles((IEnumerable<FileDescriptor>) fileDescriptors);
+ }
+
+ /// <summary>
+ /// Creates a type registry from the specified set of file descriptors.
+ /// </summary>
+ /// <remarks>
+ /// All message types within all the specified files are added to the registry, and
+ /// the dependencies of the specified files are also added, recursively.
+ /// </remarks>
+ /// <param name="fileDescriptors">The set of files to include in the registry. Must not contain null values.</param>
+ /// <returns>A type registry for the given files.</returns>
+ public static TypeRegistry FromFiles(IEnumerable<FileDescriptor> fileDescriptors)
+ {
+ ProtoPreconditions.CheckNotNull(fileDescriptors, nameof(fileDescriptors));
+ var builder = new Builder();
+ foreach (var file in fileDescriptors)
+ {
+ builder.AddFile(file);
+ }
+ return builder.Build();
+ }
+
+ /// <summary>
+ /// Creates a type registry from the file descriptor parents of the specified set of message descriptors.
+ /// </summary>
+ /// <remarks>
+ /// This is a convenience overload for <see cref="FromMessages(IEnumerable{MessageDescriptor})"/>
+ /// to allow calls such as <c>TypeRegistry.FromFiles(descriptor1, descriptor2)</c>.
+ /// </remarks>
+ /// <param name="messageDescriptors">The set of message descriptors to use to identify file descriptors to include in the registry.
+ /// Must not contain null values.</param>
+ /// <returns>A type registry for the given files.</returns>
+ public static TypeRegistry FromMessages(params MessageDescriptor[] messageDescriptors)
+ {
+ return FromMessages((IEnumerable<MessageDescriptor>) messageDescriptors);
+ }
+
+ /// <summary>
+ /// Creates a type registry from the file descriptor parents of the specified set of message descriptors.
+ /// </summary>
+ /// <remarks>
+ /// The specified message descriptors are only used to identify their file descriptors; the returned registry
+ /// contains all the types within the file descriptors which contain the specified message descriptors (and
+ /// the dependencies of those files), not just the specified messages.
+ /// </remarks>
+ /// <param name="messageDescriptors">The set of message descriptors to use to identify file descriptors to include in the registry.
+ /// Must not contain null values.</param>
+ /// <returns>A type registry for the given files.</returns>
+ public static TypeRegistry FromMessages(IEnumerable<MessageDescriptor> messageDescriptors)
+ {
+ ProtoPreconditions.CheckNotNull(messageDescriptors, nameof(messageDescriptors));
+ return FromFiles(messageDescriptors.Select(md => md.File));
+ }
+
+ /// <summary>
+ /// Builder class which isn't exposed, but acts as a convenient alternative to passing round two dictionaries in recursive calls.
+ /// </summary>
+ private class Builder
+ {
+ private readonly Dictionary<string, MessageDescriptor> types;
+ private readonly HashSet<string> fileDescriptorNames;
+
+ internal Builder()
+ {
+ types = new Dictionary<string, MessageDescriptor>();
+ fileDescriptorNames = new HashSet<string>();
+ }
+
+ internal void AddFile(FileDescriptor fileDescriptor)
+ {
+ if (!fileDescriptorNames.Add(fileDescriptor.Name))
+ {
+ return;
+ }
+ foreach (var dependency in fileDescriptor.Dependencies)
+ {
+ AddFile(dependency);
+ }
+ foreach (var message in fileDescriptor.MessageTypes)
+ {
+ AddMessage(message);
+ }
+ }
+
+ private void AddMessage(MessageDescriptor messageDescriptor)
+ {
+ foreach (var nestedType in messageDescriptor.NestedTypes)
+ {
+ AddMessage(nestedType);
+ }
+ // This will overwrite any previous entry. Given that each file should
+ // only be added once, this could be a problem such as package A.B with type C,
+ // and package A with type B.C... it's unclear what we should do in that case.
+ types[messageDescriptor.FullName] = messageDescriptor;
+ }
+
+ internal TypeRegistry Build()
+ {
+ return new TypeRegistry(types);
+ }
+ }
+ }
+}