aboutsummaryrefslogtreecommitdiffhomepage
path: root/csharp/src/Google.Protobuf/Reflection
diff options
context:
space:
mode:
authorGravatar Jon Skeet <jonskeet@google.com>2015-07-17 08:26:04 +0100
committerGravatar Jon Skeet <jonskeet@google.com>2015-07-17 08:26:04 +0100
commit59eeebee870332ea2b9085688ba524c69311f662 (patch)
tree4300e8aeaff6a3b706c398496a692f5ed25f43b7 /csharp/src/Google.Protobuf/Reflection
parent0f442a7533b1d06ce0092b28f10af481b99e1369 (diff)
First pass at the big rename from ProtocolBuffers to Google.Protobuf.
We'll see what I've missed when CI fails...
Diffstat (limited to 'csharp/src/Google.Protobuf/Reflection')
-rw-r--r--csharp/src/Google.Protobuf/Reflection/DescriptorBase.cs82
-rw-r--r--csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs365
-rw-r--r--csharp/src/Google.Protobuf/Reflection/DescriptorProtoFile.cs4943
-rw-r--r--csharp/src/Google.Protobuf/Reflection/DescriptorUtil.cs65
-rw-r--r--csharp/src/Google.Protobuf/Reflection/DescriptorValidationException.cs80
-rw-r--r--csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs108
-rw-r--r--csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs61
-rw-r--r--csharp/src/Google.Protobuf/Reflection/FieldAccessorBase.cs67
-rw-r--r--csharp/src/Google.Protobuf/Reflection/FieldAccessorTable.cs97
-rw-r--r--csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs292
-rw-r--r--csharp/src/Google.Protobuf/Reflection/FieldType.cs60
-rw-r--r--csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs352
-rw-r--r--csharp/src/Google.Protobuf/Reflection/IDescriptor.cs44
-rw-r--r--csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs70
-rw-r--r--csharp/src/Google.Protobuf/Reflection/MapFieldAccessor.cs58
-rw-r--r--csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs172
-rw-r--r--csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs93
-rw-r--r--csharp/src/Google.Protobuf/Reflection/OneofAccessor.cs85
-rw-r--r--csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs78
-rw-r--r--csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs68
-rw-r--r--csharp/src/Google.Protobuf/Reflection/PartialClasses.cs47
-rw-r--r--csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs106
-rw-r--r--csharp/src/Google.Protobuf/Reflection/RepeatedFieldAccessor.cs59
-rw-r--r--csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs89
-rw-r--r--csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs85
25 files changed, 7626 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf/Reflection/DescriptorBase.cs b/csharp/src/Google.Protobuf/Reflection/DescriptorBase.cs
new file mode 100644
index 00000000..0300cd58
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/DescriptorBase.cs
@@ -0,0 +1,82 @@
+#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; }
+ }
+
+ 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..157ea400
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs
@@ -0,0 +1,365 @@
+#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;
+ }
+
+ 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>
+ internal IDescriptor LookupSymbol(string name, IDescriptor relativeTo)
+ {
+ // TODO(jonskeet): This could be optimized in a number of ways.
+
+ 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.
+
+ // TODO(jonskeet): Make this more efficient. May not be worth using StringBuilder at all
+ 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/DescriptorProtoFile.cs b/csharp/src/Google.Protobuf/Reflection/DescriptorProtoFile.cs
new file mode 100644
index 00000000..c87969b9
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/DescriptorProtoFile.cs
@@ -0,0 +1,4943 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: google/protobuf/descriptor_proto_file.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 {
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal static partial class DescriptorProtoFile {
+
+ #region Static variables
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_FileDescriptorSet__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_FileDescriptorProto__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_DescriptorProto__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_DescriptorProto_ExtensionRange__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_DescriptorProto_ReservedRange__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_FieldDescriptorProto__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_OneofDescriptorProto__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_EnumDescriptorProto__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_EnumValueDescriptorProto__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_ServiceDescriptorProto__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_MethodDescriptorProto__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_FileOptions__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_MessageOptions__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_FieldOptions__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_EnumOptions__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_EnumValueOptions__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_ServiceOptions__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_MethodOptions__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_UninterpretedOption__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_UninterpretedOption_NamePart__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_SourceCodeInfo__FieldAccessorTable;
+ internal static pbr::FieldAccessorTable internal__static_google_protobuf_SourceCodeInfo_Location__FieldAccessorTable;
+ #endregion
+ #region Descriptor
+ public static pbr::FileDescriptor Descriptor {
+ get { return descriptor; }
+ }
+ private static pbr::FileDescriptor descriptor;
+
+ static DescriptorProtoFile() {
+ byte[] descriptorData = global::System.Convert.FromBase64String(
+ string.Concat(
+ "Citnb29nbGUvcHJvdG9idWYvZGVzY3JpcHRvcl9wcm90b19maWxlLnByb3Rv",
+ "Eg9nb29nbGUucHJvdG9idWYiRwoRRmlsZURlc2NyaXB0b3JTZXQSMgoEZmls",
+ "ZRgBIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5GaWxlRGVzY3JpcHRvclByb3Rv",
+ "ItsDChNGaWxlRGVzY3JpcHRvclByb3RvEgwKBG5hbWUYASABKAkSDwoHcGFj",
+ "a2FnZRgCIAEoCRISCgpkZXBlbmRlbmN5GAMgAygJEhkKEXB1YmxpY19kZXBl",
+ "bmRlbmN5GAogAygFEhcKD3dlYWtfZGVwZW5kZW5jeRgLIAMoBRI2CgxtZXNz",
+ "YWdlX3R5cGUYBCADKAsyIC5nb29nbGUucHJvdG9idWYuRGVzY3JpcHRvclBy",
+ "b3RvEjcKCWVudW1fdHlwZRgFIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5FbnVt",
+ "RGVzY3JpcHRvclByb3RvEjgKB3NlcnZpY2UYBiADKAsyJy5nb29nbGUucHJv",
+ "dG9idWYuU2VydmljZURlc2NyaXB0b3JQcm90bxI4CglleHRlbnNpb24YByAD",
+ "KAsyJS5nb29nbGUucHJvdG9idWYuRmllbGREZXNjcmlwdG9yUHJvdG8SLQoH",
+ "b3B0aW9ucxgIIAEoCzIcLmdvb2dsZS5wcm90b2J1Zi5GaWxlT3B0aW9ucxI5",
+ "ChBzb3VyY2VfY29kZV9pbmZvGAkgASgLMh8uZ29vZ2xlLnByb3RvYnVmLlNv",
+ "dXJjZUNvZGVJbmZvEg4KBnN5bnRheBgMIAEoCSLwBAoPRGVzY3JpcHRvclBy",
+ "b3RvEgwKBG5hbWUYASABKAkSNAoFZmllbGQYAiADKAsyJS5nb29nbGUucHJv",
+ "dG9idWYuRmllbGREZXNjcmlwdG9yUHJvdG8SOAoJZXh0ZW5zaW9uGAYgAygL",
+ "MiUuZ29vZ2xlLnByb3RvYnVmLkZpZWxkRGVzY3JpcHRvclByb3RvEjUKC25l",
+ "c3RlZF90eXBlGAMgAygLMiAuZ29vZ2xlLnByb3RvYnVmLkRlc2NyaXB0b3JQ",
+ "cm90bxI3CgllbnVtX3R5cGUYBCADKAsyJC5nb29nbGUucHJvdG9idWYuRW51",
+ "bURlc2NyaXB0b3JQcm90bxJICg9leHRlbnNpb25fcmFuZ2UYBSADKAsyLy5n",
+ "b29nbGUucHJvdG9idWYuRGVzY3JpcHRvclByb3RvLkV4dGVuc2lvblJhbmdl",
+ "EjkKCm9uZW9mX2RlY2wYCCADKAsyJS5nb29nbGUucHJvdG9idWYuT25lb2ZE",
+ "ZXNjcmlwdG9yUHJvdG8SMAoHb3B0aW9ucxgHIAEoCzIfLmdvb2dsZS5wcm90",
+ "b2J1Zi5NZXNzYWdlT3B0aW9ucxJGCg5yZXNlcnZlZF9yYW5nZRgJIAMoCzIu",
+ "Lmdvb2dsZS5wcm90b2J1Zi5EZXNjcmlwdG9yUHJvdG8uUmVzZXJ2ZWRSYW5n",
+ "ZRIVCg1yZXNlcnZlZF9uYW1lGAogAygJGiwKDkV4dGVuc2lvblJhbmdlEg0K",
+ "BXN0YXJ0GAEgASgFEgsKA2VuZBgCIAEoBRorCg1SZXNlcnZlZFJhbmdlEg0K",
+ "BXN0YXJ0GAEgASgFEgsKA2VuZBgCIAEoBSKpBQoURmllbGREZXNjcmlwdG9y",
+ "UHJvdG8SDAoEbmFtZRgBIAEoCRIOCgZudW1iZXIYAyABKAUSOgoFbGFiZWwY",
+ "BCABKA4yKy5nb29nbGUucHJvdG9idWYuRmllbGREZXNjcmlwdG9yUHJvdG8u",
+ "TGFiZWwSOAoEdHlwZRgFIAEoDjIqLmdvb2dsZS5wcm90b2J1Zi5GaWVsZERl",
+ "c2NyaXB0b3JQcm90by5UeXBlEhEKCXR5cGVfbmFtZRgGIAEoCRIQCghleHRl",
+ "bmRlZRgCIAEoCRIVCg1kZWZhdWx0X3ZhbHVlGAcgASgJEhMKC29uZW9mX2lu",
+ "ZGV4GAkgASgFEi4KB29wdGlvbnMYCCABKAsyHS5nb29nbGUucHJvdG9idWYu",
+ "RmllbGRPcHRpb25zIrYCCgRUeXBlEg8KC1RZUEVfRE9VQkxFEAESDgoKVFlQ",
+ "RV9GTE9BVBACEg4KClRZUEVfSU5UNjQQAxIPCgtUWVBFX1VJTlQ2NBAEEg4K",
+ "ClRZUEVfSU5UMzIQBRIQCgxUWVBFX0ZJWEVENjQQBhIQCgxUWVBFX0ZJWEVE",
+ "MzIQBxINCglUWVBFX0JPT0wQCBIPCgtUWVBFX1NUUklORxAJEg4KClRZUEVf",
+ "R1JPVVAQChIQCgxUWVBFX01FU1NBR0UQCxIOCgpUWVBFX0JZVEVTEAwSDwoL",
+ "VFlQRV9VSU5UMzIQDRINCglUWVBFX0VOVU0QDhIRCg1UWVBFX1NGSVhFRDMy",
+ "EA8SEQoNVFlQRV9TRklYRUQ2NBAQEg8KC1RZUEVfU0lOVDMyEBESDwoLVFlQ",
+ "RV9TSU5UNjQQEiJDCgVMYWJlbBISCg5MQUJFTF9PUFRJT05BTBABEhIKDkxB",
+ "QkVMX1JFUVVJUkVEEAISEgoOTEFCRUxfUkVQRUFURUQQAyIkChRPbmVvZkRl",
+ "c2NyaXB0b3JQcm90bxIMCgRuYW1lGAEgASgJIowBChNFbnVtRGVzY3JpcHRv",
+ "clByb3RvEgwKBG5hbWUYASABKAkSOAoFdmFsdWUYAiADKAsyKS5nb29nbGUu",
+ "cHJvdG9idWYuRW51bVZhbHVlRGVzY3JpcHRvclByb3RvEi0KB29wdGlvbnMY",
+ "AyABKAsyHC5nb29nbGUucHJvdG9idWYuRW51bU9wdGlvbnMibAoYRW51bVZh",
+ "bHVlRGVzY3JpcHRvclByb3RvEgwKBG5hbWUYASABKAkSDgoGbnVtYmVyGAIg",
+ "ASgFEjIKB29wdGlvbnMYAyABKAsyIS5nb29nbGUucHJvdG9idWYuRW51bVZh",
+ "bHVlT3B0aW9ucyKQAQoWU2VydmljZURlc2NyaXB0b3JQcm90bxIMCgRuYW1l",
+ "GAEgASgJEjYKBm1ldGhvZBgCIAMoCzImLmdvb2dsZS5wcm90b2J1Zi5NZXRo",
+ "b2REZXNjcmlwdG9yUHJvdG8SMAoHb3B0aW9ucxgDIAEoCzIfLmdvb2dsZS5w",
+ "cm90b2J1Zi5TZXJ2aWNlT3B0aW9ucyLBAQoVTWV0aG9kRGVzY3JpcHRvclBy",
+ "b3RvEgwKBG5hbWUYASABKAkSEgoKaW5wdXRfdHlwZRgCIAEoCRITCgtvdXRw",
+ "dXRfdHlwZRgDIAEoCRIvCgdvcHRpb25zGAQgASgLMh4uZ29vZ2xlLnByb3Rv",
+ "YnVmLk1ldGhvZE9wdGlvbnMSHwoQY2xpZW50X3N0cmVhbWluZxgFIAEoCDoF",
+ "ZmFsc2USHwoQc2VydmVyX3N0cmVhbWluZxgGIAEoCDoFZmFsc2UigQUKC0Zp",
+ "bGVPcHRpb25zEhQKDGphdmFfcGFja2FnZRgBIAEoCRIcChRqYXZhX291dGVy",
+ "X2NsYXNzbmFtZRgIIAEoCRIiChNqYXZhX211bHRpcGxlX2ZpbGVzGAogASgI",
+ "OgVmYWxzZRIsCh1qYXZhX2dlbmVyYXRlX2VxdWFsc19hbmRfaGFzaBgUIAEo",
+ "CDoFZmFsc2USJQoWamF2YV9zdHJpbmdfY2hlY2tfdXRmOBgbIAEoCDoFZmFs",
+ "c2USRgoMb3B0aW1pemVfZm9yGAkgASgOMikuZ29vZ2xlLnByb3RvYnVmLkZp",
+ "bGVPcHRpb25zLk9wdGltaXplTW9kZToFU1BFRUQSEgoKZ29fcGFja2FnZRgL",
+ "IAEoCRIiChNjY19nZW5lcmljX3NlcnZpY2VzGBAgASgIOgVmYWxzZRIkChVq",
+ "YXZhX2dlbmVyaWNfc2VydmljZXMYESABKAg6BWZhbHNlEiIKE3B5X2dlbmVy",
+ "aWNfc2VydmljZXMYEiABKAg6BWZhbHNlEhkKCmRlcHJlY2F0ZWQYFyABKAg6",
+ "BWZhbHNlEh8KEGNjX2VuYWJsZV9hcmVuYXMYHyABKAg6BWZhbHNlEhkKEW9i",
+ "amNfY2xhc3NfcHJlZml4GCQgASgJEhgKEGNzaGFycF9uYW1lc3BhY2UYJSAB",
+ "KAkSQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xlLnBy",
+ "b3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24iOgoMT3B0aW1pemVNb2RlEgkK",
+ "BVNQRUVEEAESDQoJQ09ERV9TSVpFEAISEAoMTElURV9SVU5USU1FEAMqCQjo",
+ "BxCAgICAAiLmAQoOTWVzc2FnZU9wdGlvbnMSJgoXbWVzc2FnZV9zZXRfd2ly",
+ "ZV9mb3JtYXQYASABKAg6BWZhbHNlEi4KH25vX3N0YW5kYXJkX2Rlc2NyaXB0",
+ "b3JfYWNjZXNzb3IYAiABKAg6BWZhbHNlEhkKCmRlcHJlY2F0ZWQYAyABKAg6",
+ "BWZhbHNlEhEKCW1hcF9lbnRyeRgHIAEoCBJDChR1bmludGVycHJldGVkX29w",
+ "dGlvbhjnByADKAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9w",
+ "dGlvbioJCOgHEICAgIACIpgDCgxGaWVsZE9wdGlvbnMSOgoFY3R5cGUYASAB",
+ "KA4yIy5nb29nbGUucHJvdG9idWYuRmllbGRPcHRpb25zLkNUeXBlOgZTVFJJ",
+ "TkcSDgoGcGFja2VkGAIgASgIEj8KBmpzdHlwZRgGIAEoDjIkLmdvb2dsZS5w",
+ "cm90b2J1Zi5GaWVsZE9wdGlvbnMuSlNUeXBlOglKU19OT1JNQUwSEwoEbGF6",
+ "eRgFIAEoCDoFZmFsc2USGQoKZGVwcmVjYXRlZBgDIAEoCDoFZmFsc2USEwoE",
+ "d2VhaxgKIAEoCDoFZmFsc2USQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcg",
+ "AygLMiQuZ29vZ2xlLnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24iLwoF",
+ "Q1R5cGUSCgoGU1RSSU5HEAASCAoEQ09SRBABEhAKDFNUUklOR19QSUVDRRAC",
+ "IjUKBkpTVHlwZRINCglKU19OT1JNQUwQABINCglKU19TVFJJTkcQARINCglK",
+ "U19OVU1CRVIQAioJCOgHEICAgIACIo0BCgtFbnVtT3B0aW9ucxITCgthbGxv",
+ "d19hbGlhcxgCIAEoCBIZCgpkZXByZWNhdGVkGAMgASgIOgVmYWxzZRJDChR1",
+ "bmludGVycHJldGVkX29wdGlvbhjnByADKAsyJC5nb29nbGUucHJvdG9idWYu",
+ "VW5pbnRlcnByZXRlZE9wdGlvbioJCOgHEICAgIACIn0KEEVudW1WYWx1ZU9w",
+ "dGlvbnMSGQoKZGVwcmVjYXRlZBgBIAEoCDoFZmFsc2USQwoUdW5pbnRlcnBy",
+ "ZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xlLnByb3RvYnVmLlVuaW50ZXJw",
+ "cmV0ZWRPcHRpb24qCQjoBxCAgICAAiJ7Cg5TZXJ2aWNlT3B0aW9ucxIZCgpk",
+ "ZXByZWNhdGVkGCEgASgIOgVmYWxzZRJDChR1bmludGVycHJldGVkX29wdGlv",
+ "bhjnByADKAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlv",
+ "bioJCOgHEICAgIACInoKDU1ldGhvZE9wdGlvbnMSGQoKZGVwcmVjYXRlZBgh",
+ "IAEoCDoFZmFsc2USQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQu",
+ "Z29vZ2xlLnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24qCQjoBxCAgICA",
+ "AiKeAgoTVW5pbnRlcnByZXRlZE9wdGlvbhI7CgRuYW1lGAIgAygLMi0uZ29v",
+ "Z2xlLnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24uTmFtZVBhcnQSGAoQ",
+ "aWRlbnRpZmllcl92YWx1ZRgDIAEoCRIaChJwb3NpdGl2ZV9pbnRfdmFsdWUY",
+ "BCABKAQSGgoSbmVnYXRpdmVfaW50X3ZhbHVlGAUgASgDEhQKDGRvdWJsZV92",
+ "YWx1ZRgGIAEoARIUCgxzdHJpbmdfdmFsdWUYByABKAwSFwoPYWdncmVnYXRl",
+ "X3ZhbHVlGAggASgJGjMKCE5hbWVQYXJ0EhEKCW5hbWVfcGFydBgBIAIoCRIU",
+ "Cgxpc19leHRlbnNpb24YAiACKAgi1QEKDlNvdXJjZUNvZGVJbmZvEjoKCGxv",
+ "Y2F0aW9uGAEgAygLMiguZ29vZ2xlLnByb3RvYnVmLlNvdXJjZUNvZGVJbmZv",
+ "LkxvY2F0aW9uGoYBCghMb2NhdGlvbhIQCgRwYXRoGAEgAygFQgIQARIQCgRz",
+ "cGFuGAIgAygFQgIQARIYChBsZWFkaW5nX2NvbW1lbnRzGAMgASgJEhkKEXRy",
+ "YWlsaW5nX2NvbW1lbnRzGAQgASgJEiEKGWxlYWRpbmdfZGV0YWNoZWRfY29t",
+ "bWVudHMYBiADKAlCWAoTY29tLmdvb2dsZS5wcm90b2J1ZkIQRGVzY3JpcHRv",
+ "clByb3Rvc0gBWgpkZXNjcmlwdG9yogIDR1BCqgIaR29vZ2xlLlByb3RvYnVm",
+ "LlJlZmxlY3Rpb24="));
+ descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
+ new pbr::FileDescriptor[] {
+ });
+ internal__static_google_protobuf_FileDescriptorSet__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.FileDescriptorSet), descriptor.MessageTypes[0],
+ new string[] { "File", }, new string[] { });
+ internal__static_google_protobuf_FileDescriptorProto__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.FileDescriptorProto), descriptor.MessageTypes[1],
+ new string[] { "Name", "Package", "Dependency", "PublicDependency", "WeakDependency", "MessageType", "EnumType", "Service", "Extension", "Options", "SourceCodeInfo", "Syntax", }, new string[] { });
+ internal__static_google_protobuf_DescriptorProto__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.DescriptorProto), descriptor.MessageTypes[2],
+ new string[] { "Name", "Field", "Extension", "NestedType", "EnumType", "ExtensionRange", "OneofDecl", "Options", "ReservedRange", "ReservedName", }, new string[] { });
+ internal__static_google_protobuf_DescriptorProto_ExtensionRange__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange), descriptor.MessageTypes[2].NestedTypes[0],
+ new string[] { "Start", "End", }, new string[] { });
+ internal__static_google_protobuf_DescriptorProto_ReservedRange__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange), descriptor.MessageTypes[2].NestedTypes[1],
+ new string[] { "Start", "End", }, new string[] { });
+ internal__static_google_protobuf_FieldDescriptorProto__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto), descriptor.MessageTypes[3],
+ new string[] { "Name", "Number", "Label", "Type", "TypeName", "Extendee", "DefaultValue", "OneofIndex", "Options", }, new string[] { });
+ internal__static_google_protobuf_OneofDescriptorProto__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.OneofDescriptorProto), descriptor.MessageTypes[4],
+ new string[] { "Name", }, new string[] { });
+ internal__static_google_protobuf_EnumDescriptorProto__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.EnumDescriptorProto), descriptor.MessageTypes[5],
+ new string[] { "Name", "Value", "Options", }, new string[] { });
+ internal__static_google_protobuf_EnumValueDescriptorProto__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.EnumValueDescriptorProto), descriptor.MessageTypes[6],
+ new string[] { "Name", "Number", "Options", }, new string[] { });
+ internal__static_google_protobuf_ServiceDescriptorProto__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.ServiceDescriptorProto), descriptor.MessageTypes[7],
+ new string[] { "Name", "Method", "Options", }, new string[] { });
+ internal__static_google_protobuf_MethodDescriptorProto__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.MethodDescriptorProto), descriptor.MessageTypes[8],
+ new string[] { "Name", "InputType", "OutputType", "Options", "ClientStreaming", "ServerStreaming", }, new string[] { });
+ internal__static_google_protobuf_FileOptions__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.FileOptions), descriptor.MessageTypes[9],
+ new string[] { "JavaPackage", "JavaOuterClassname", "JavaMultipleFiles", "JavaGenerateEqualsAndHash", "JavaStringCheckUtf8", "OptimizeFor", "GoPackage", "CcGenericServices", "JavaGenericServices", "PyGenericServices", "Deprecated", "CcEnableArenas", "ObjcClassPrefix", "CsharpNamespace", "UninterpretedOption", }, new string[] { });
+ internal__static_google_protobuf_MessageOptions__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.MessageOptions), descriptor.MessageTypes[10],
+ new string[] { "MessageSetWireFormat", "NoStandardDescriptorAccessor", "Deprecated", "MapEntry", "UninterpretedOption", }, new string[] { });
+ internal__static_google_protobuf_FieldOptions__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.FieldOptions), descriptor.MessageTypes[11],
+ new string[] { "Ctype", "Packed", "Jstype", "Lazy", "Deprecated", "Weak", "UninterpretedOption", }, new string[] { });
+ internal__static_google_protobuf_EnumOptions__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.EnumOptions), descriptor.MessageTypes[12],
+ new string[] { "AllowAlias", "Deprecated", "UninterpretedOption", }, new string[] { });
+ internal__static_google_protobuf_EnumValueOptions__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.EnumValueOptions), descriptor.MessageTypes[13],
+ new string[] { "Deprecated", "UninterpretedOption", }, new string[] { });
+ internal__static_google_protobuf_ServiceOptions__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.ServiceOptions), descriptor.MessageTypes[14],
+ new string[] { "Deprecated", "UninterpretedOption", }, new string[] { });
+ internal__static_google_protobuf_MethodOptions__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.MethodOptions), descriptor.MessageTypes[15],
+ new string[] { "Deprecated", "UninterpretedOption", }, new string[] { });
+ internal__static_google_protobuf_UninterpretedOption__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.UninterpretedOption), descriptor.MessageTypes[16],
+ new string[] { "Name", "IdentifierValue", "PositiveIntValue", "NegativeIntValue", "DoubleValue", "StringValue", "AggregateValue", }, new string[] { });
+ internal__static_google_protobuf_UninterpretedOption_NamePart__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart), descriptor.MessageTypes[16].NestedTypes[0],
+ new string[] { "NamePart_", "IsExtension", }, new string[] { });
+ internal__static_google_protobuf_SourceCodeInfo__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo), descriptor.MessageTypes[17],
+ new string[] { "Location", }, new string[] { });
+ internal__static_google_protobuf_SourceCodeInfo_Location__FieldAccessorTable =
+ new pbr::FieldAccessorTable(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location), descriptor.MessageTypes[17].NestedTypes[0],
+ new string[] { "Path", "Span", "LeadingComments", "TrailingComments", "LeadingDetachedComments", }, new string[] { });
+ }
+ #endregion
+
+ }
+ #region Messages
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class FileDescriptorSet : pb::IMessage<FileDescriptorSet> {
+ private static readonly pb::MessageParser<FileDescriptorSet> _parser = new pb::MessageParser<FileDescriptorSet>(() => new FileDescriptorSet());
+ public static pb::MessageParser<FileDescriptorSet> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "file" };
+ private static readonly uint[] _fieldTags = new uint[] { 10 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[0]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_FileDescriptorSet__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public FileDescriptorSet() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ public FileDescriptorSet(FileDescriptorSet other) : this() {
+ file_ = other.file_.Clone();
+ }
+
+ public FileDescriptorSet Clone() {
+ return new FileDescriptorSet(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ file_.Freeze();
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.FileDescriptorProto> File {
+ get { return file_; }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as FileDescriptorSet);
+ }
+
+ 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;
+ }
+
+ public override int GetHashCode() {
+ int hash = 1;
+ hash ^= file_.GetHashCode();
+ return hash;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ public void WriteTo(pb::CodedOutputStream output) {
+ file_.WriteTo(output, _repeated_file_codec);
+ }
+
+ public int CalculateSize() {
+ int size = 0;
+ size += file_.CalculateSize(_repeated_file_codec);
+ return size;
+ }
+
+ public void MergeFrom(FileDescriptorSet other) {
+ if (other == null) {
+ return;
+ }
+ file_.Add(other.file_);
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ break;
+ case 10: {
+ file_.AddEntriesFrom(input, _repeated_file_codec);
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class FileDescriptorProto : pb::IMessage<FileDescriptorProto> {
+ private static readonly pb::MessageParser<FileDescriptorProto> _parser = new pb::MessageParser<FileDescriptorProto>(() => new FileDescriptorProto());
+ public static pb::MessageParser<FileDescriptorProto> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "dependency", "enum_type", "extension", "message_type", "name", "options", "package", "public_dependency", "service", "source_code_info", "syntax", "weak_dependency" };
+ private static readonly uint[] _fieldTags = new uint[] { 26, 42, 58, 34, 10, 66, 18, 80, 50, 74, 98, 88 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[1]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_FileDescriptorProto__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public FileDescriptorProto() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ 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_;
+ }
+
+ public FileDescriptorProto Clone() {
+ return new FileDescriptorProto(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ dependency_.Freeze();
+ publicDependency_.Freeze();
+ weakDependency_.Freeze();
+ messageType_.Freeze();
+ enumType_.Freeze();
+ service_.Freeze();
+ extension_.Freeze();
+ if (options_ != null) Options.Freeze();
+ if (sourceCodeInfo_ != null) SourceCodeInfo.Freeze();
+ }
+
+ public const int NameFieldNumber = 1;
+ private string name_ = "";
+ internal string Name {
+ get { return name_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ name_ = value ?? "";
+ }
+ }
+
+ public const int PackageFieldNumber = 2;
+ private string package_ = "";
+ internal string Package {
+ get { return package_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ package_ = value ?? "";
+ }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<string> Dependency {
+ get { return dependency_; }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<int> PublicDependency {
+ get { return publicDependency_; }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<int> WeakDependency {
+ get { return weakDependency_; }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto> MessageType {
+ get { return messageType_; }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto> EnumType {
+ get { return enumType_; }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.ServiceDescriptorProto> Service {
+ get { return service_; }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> Extension {
+ get { return extension_; }
+ }
+
+ public const int OptionsFieldNumber = 8;
+ private global::Google.Protobuf.Reflection.FileOptions options_;
+ internal global::Google.Protobuf.Reflection.FileOptions Options {
+ get { return options_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ options_ = value;
+ }
+ }
+
+ public const int SourceCodeInfoFieldNumber = 9;
+ private global::Google.Protobuf.Reflection.SourceCodeInfo sourceCodeInfo_;
+ internal global::Google.Protobuf.Reflection.SourceCodeInfo SourceCodeInfo {
+ get { return sourceCodeInfo_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ sourceCodeInfo_ = value;
+ }
+ }
+
+ public const int SyntaxFieldNumber = 12;
+ private string syntax_ = "";
+ internal string Syntax {
+ get { return syntax_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ syntax_ = value ?? "";
+ }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as FileDescriptorProto);
+ }
+
+ 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;
+ }
+
+ 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;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ 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);
+ }
+ }
+
+ 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;
+ }
+
+ 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;
+ }
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ 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;
+ }
+ }
+ }
+ }
+
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class DescriptorProto : pb::IMessage<DescriptorProto> {
+ private static readonly pb::MessageParser<DescriptorProto> _parser = new pb::MessageParser<DescriptorProto>(() => new DescriptorProto());
+ public static pb::MessageParser<DescriptorProto> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "enum_type", "extension", "extension_range", "field", "name", "nested_type", "oneof_decl", "options", "reserved_name", "reserved_range" };
+ private static readonly uint[] _fieldTags = new uint[] { 34, 50, 42, 18, 10, 26, 66, 58, 82, 74 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[2]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_DescriptorProto__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public DescriptorProto() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ 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();
+ }
+
+ public DescriptorProto Clone() {
+ return new DescriptorProto(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ field_.Freeze();
+ extension_.Freeze();
+ nestedType_.Freeze();
+ enumType_.Freeze();
+ extensionRange_.Freeze();
+ oneofDecl_.Freeze();
+ if (options_ != null) Options.Freeze();
+ reservedRange_.Freeze();
+ reservedName_.Freeze();
+ }
+
+ public const int NameFieldNumber = 1;
+ private string name_ = "";
+ internal string Name {
+ get { return name_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ name_ = value ?? "";
+ }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> Field {
+ get { return field_; }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.FieldDescriptorProto> Extension {
+ get { return extension_; }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto> NestedType {
+ get { return nestedType_; }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumDescriptorProto> EnumType {
+ get { return enumType_; }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange> ExtensionRange {
+ get { return extensionRange_; }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.OneofDescriptorProto> OneofDecl {
+ get { return oneofDecl_; }
+ }
+
+ public const int OptionsFieldNumber = 7;
+ private global::Google.Protobuf.Reflection.MessageOptions options_;
+ internal global::Google.Protobuf.Reflection.MessageOptions Options {
+ get { return options_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ options_ = value;
+ }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange> ReservedRange {
+ get { return reservedRange_; }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<string> ReservedName {
+ get { return reservedName_; }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as DescriptorProto);
+ }
+
+ 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;
+ }
+
+ 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;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ 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);
+ }
+
+ 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;
+ }
+
+ 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_);
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ 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
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public static partial class Types {
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class ExtensionRange : pb::IMessage<ExtensionRange> {
+ private static readonly pb::MessageParser<ExtensionRange> _parser = new pb::MessageParser<ExtensionRange>(() => new ExtensionRange());
+ public static pb::MessageParser<ExtensionRange> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "end", "start" };
+ private static readonly uint[] _fieldTags = new uint[] { 16, 8 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProto.Descriptor.NestedTypes[0]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_DescriptorProto_ExtensionRange__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public ExtensionRange() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ public ExtensionRange(ExtensionRange other) : this() {
+ start_ = other.start_;
+ end_ = other.end_;
+ }
+
+ public ExtensionRange Clone() {
+ return new ExtensionRange(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ }
+
+ public const int StartFieldNumber = 1;
+ private int start_;
+ internal int Start {
+ get { return start_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ start_ = value;
+ }
+ }
+
+ public const int EndFieldNumber = 2;
+ private int end_;
+ internal int End {
+ get { return end_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ end_ = value;
+ }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as ExtensionRange);
+ }
+
+ 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;
+ }
+
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Start != 0) hash ^= Start.GetHashCode();
+ if (End != 0) hash ^= End.GetHashCode();
+ return hash;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Start != 0) {
+ output.WriteRawTag(8);
+ output.WriteInt32(Start);
+ }
+ if (End != 0) {
+ output.WriteRawTag(16);
+ output.WriteInt32(End);
+ }
+ }
+
+ 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;
+ }
+
+ public void MergeFrom(ExtensionRange other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Start != 0) {
+ Start = other.Start;
+ }
+ if (other.End != 0) {
+ End = other.End;
+ }
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ break;
+ case 8: {
+ Start = input.ReadInt32();
+ break;
+ }
+ case 16: {
+ End = input.ReadInt32();
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class ReservedRange : pb::IMessage<ReservedRange> {
+ private static readonly pb::MessageParser<ReservedRange> _parser = new pb::MessageParser<ReservedRange>(() => new ReservedRange());
+ public static pb::MessageParser<ReservedRange> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "end", "start" };
+ private static readonly uint[] _fieldTags = new uint[] { 16, 8 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProto.Descriptor.NestedTypes[1]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_DescriptorProto_ReservedRange__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public ReservedRange() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ public ReservedRange(ReservedRange other) : this() {
+ start_ = other.start_;
+ end_ = other.end_;
+ }
+
+ public ReservedRange Clone() {
+ return new ReservedRange(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ }
+
+ public const int StartFieldNumber = 1;
+ private int start_;
+ internal int Start {
+ get { return start_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ start_ = value;
+ }
+ }
+
+ public const int EndFieldNumber = 2;
+ private int end_;
+ internal int End {
+ get { return end_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ end_ = value;
+ }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as ReservedRange);
+ }
+
+ 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;
+ }
+
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Start != 0) hash ^= Start.GetHashCode();
+ if (End != 0) hash ^= End.GetHashCode();
+ return hash;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Start != 0) {
+ output.WriteRawTag(8);
+ output.WriteInt32(Start);
+ }
+ if (End != 0) {
+ output.WriteRawTag(16);
+ output.WriteInt32(End);
+ }
+ }
+
+ 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;
+ }
+
+ public void MergeFrom(ReservedRange other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Start != 0) {
+ Start = other.Start;
+ }
+ if (other.End != 0) {
+ End = other.End;
+ }
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ break;
+ case 8: {
+ Start = input.ReadInt32();
+ break;
+ }
+ case 16: {
+ End = input.ReadInt32();
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ }
+ #endregion
+
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class FieldDescriptorProto : pb::IMessage<FieldDescriptorProto> {
+ private static readonly pb::MessageParser<FieldDescriptorProto> _parser = new pb::MessageParser<FieldDescriptorProto>(() => new FieldDescriptorProto());
+ public static pb::MessageParser<FieldDescriptorProto> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "default_value", "extendee", "label", "name", "number", "oneof_index", "options", "type", "type_name" };
+ private static readonly uint[] _fieldTags = new uint[] { 58, 18, 32, 10, 24, 72, 66, 40, 50 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[3]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_FieldDescriptorProto__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public FieldDescriptorProto() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ 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_;
+ Options = other.options_ != null ? other.Options.Clone() : null;
+ }
+
+ public FieldDescriptorProto Clone() {
+ return new FieldDescriptorProto(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ if (options_ != null) Options.Freeze();
+ }
+
+ public const int NameFieldNumber = 1;
+ private string name_ = "";
+ internal string Name {
+ get { return name_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ name_ = value ?? "";
+ }
+ }
+
+ public const int NumberFieldNumber = 3;
+ private int number_;
+ internal int Number {
+ get { return number_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ number_ = value;
+ }
+ }
+
+ public const int LabelFieldNumber = 4;
+ private global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label label_ = global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL;
+ internal global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label Label {
+ get { return label_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ label_ = value;
+ }
+ }
+
+ public const int TypeFieldNumber = 5;
+ private global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type type_ = global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type.TYPE_DOUBLE;
+ internal global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type Type {
+ get { return type_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ type_ = value;
+ }
+ }
+
+ public const int TypeNameFieldNumber = 6;
+ private string typeName_ = "";
+ internal string TypeName {
+ get { return typeName_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ typeName_ = value ?? "";
+ }
+ }
+
+ public const int ExtendeeFieldNumber = 2;
+ private string extendee_ = "";
+ internal string Extendee {
+ get { return extendee_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ extendee_ = value ?? "";
+ }
+ }
+
+ public const int DefaultValueFieldNumber = 7;
+ private string defaultValue_ = "";
+ internal string DefaultValue {
+ get { return defaultValue_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ defaultValue_ = value ?? "";
+ }
+ }
+
+ public const int OneofIndexFieldNumber = 9;
+ private int oneofIndex_;
+ internal int OneofIndex {
+ get { return oneofIndex_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ oneofIndex_ = value;
+ }
+ }
+
+ public const int OptionsFieldNumber = 8;
+ private global::Google.Protobuf.Reflection.FieldOptions options_;
+ internal global::Google.Protobuf.Reflection.FieldOptions Options {
+ get { return options_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ options_ = value;
+ }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as FieldDescriptorProto);
+ }
+
+ 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 (!object.Equals(Options, other.Options)) return false;
+ return true;
+ }
+
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Name.Length != 0) hash ^= Name.GetHashCode();
+ if (Number != 0) hash ^= Number.GetHashCode();
+ if (Label != global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL) hash ^= Label.GetHashCode();
+ if (Type != global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type.TYPE_DOUBLE) 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 (options_ != null) hash ^= Options.GetHashCode();
+ return hash;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ 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 != global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL) {
+ output.WriteRawTag(32);
+ output.WriteEnum((int) Label);
+ }
+ if (Type != global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type.TYPE_DOUBLE) {
+ 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);
+ }
+ }
+
+ 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 != global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL) {
+ size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Label);
+ }
+ if (Type != global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type.TYPE_DOUBLE) {
+ 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 (options_ != null) {
+ size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
+ }
+ return size;
+ }
+
+ 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 != global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL) {
+ Label = other.Label;
+ }
+ if (other.Type != global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type.TYPE_DOUBLE) {
+ 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.options_ != null) {
+ if (options_ == null) {
+ options_ = new global::Google.Protobuf.Reflection.FieldOptions();
+ }
+ Options.MergeFrom(other.Options);
+ }
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ 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;
+ }
+ }
+ }
+ }
+
+ #region Nested types
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public static partial class Types {
+ internal enum Type {
+ TYPE_DOUBLE = 1,
+ TYPE_FLOAT = 2,
+ TYPE_INT64 = 3,
+ TYPE_UINT64 = 4,
+ TYPE_INT32 = 5,
+ TYPE_FIXED64 = 6,
+ TYPE_FIXED32 = 7,
+ TYPE_BOOL = 8,
+ TYPE_STRING = 9,
+ TYPE_GROUP = 10,
+ TYPE_MESSAGE = 11,
+ TYPE_BYTES = 12,
+ TYPE_UINT32 = 13,
+ TYPE_ENUM = 14,
+ TYPE_SFIXED32 = 15,
+ TYPE_SFIXED64 = 16,
+ TYPE_SINT32 = 17,
+ TYPE_SINT64 = 18,
+ }
+
+ internal enum Label {
+ LABEL_OPTIONAL = 1,
+ LABEL_REQUIRED = 2,
+ LABEL_REPEATED = 3,
+ }
+
+ }
+ #endregion
+
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class OneofDescriptorProto : pb::IMessage<OneofDescriptorProto> {
+ private static readonly pb::MessageParser<OneofDescriptorProto> _parser = new pb::MessageParser<OneofDescriptorProto>(() => new OneofDescriptorProto());
+ public static pb::MessageParser<OneofDescriptorProto> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "name" };
+ private static readonly uint[] _fieldTags = new uint[] { 10 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[4]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_OneofDescriptorProto__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public OneofDescriptorProto() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ public OneofDescriptorProto(OneofDescriptorProto other) : this() {
+ name_ = other.name_;
+ }
+
+ public OneofDescriptorProto Clone() {
+ return new OneofDescriptorProto(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ }
+
+ public const int NameFieldNumber = 1;
+ private string name_ = "";
+ internal string Name {
+ get { return name_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ name_ = value ?? "";
+ }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as OneofDescriptorProto);
+ }
+
+ public bool Equals(OneofDescriptorProto other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (Name != other.Name) return false;
+ return true;
+ }
+
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Name.Length != 0) hash ^= Name.GetHashCode();
+ return hash;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Name.Length != 0) {
+ output.WriteRawTag(10);
+ output.WriteString(Name);
+ }
+ }
+
+ public int CalculateSize() {
+ int size = 0;
+ if (Name.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
+ }
+ return size;
+ }
+
+ public void MergeFrom(OneofDescriptorProto other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Name.Length != 0) {
+ Name = other.Name;
+ }
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ break;
+ case 10: {
+ Name = input.ReadString();
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class EnumDescriptorProto : pb::IMessage<EnumDescriptorProto> {
+ private static readonly pb::MessageParser<EnumDescriptorProto> _parser = new pb::MessageParser<EnumDescriptorProto>(() => new EnumDescriptorProto());
+ public static pb::MessageParser<EnumDescriptorProto> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "name", "options", "value" };
+ private static readonly uint[] _fieldTags = new uint[] { 10, 26, 18 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[5]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_EnumDescriptorProto__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public EnumDescriptorProto() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ public EnumDescriptorProto(EnumDescriptorProto other) : this() {
+ name_ = other.name_;
+ value_ = other.value_.Clone();
+ Options = other.options_ != null ? other.Options.Clone() : null;
+ }
+
+ public EnumDescriptorProto Clone() {
+ return new EnumDescriptorProto(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ value_.Freeze();
+ if (options_ != null) Options.Freeze();
+ }
+
+ public const int NameFieldNumber = 1;
+ private string name_ = "";
+ internal string Name {
+ get { return name_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ name_ = value ?? "";
+ }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.EnumValueDescriptorProto> Value {
+ get { return value_; }
+ }
+
+ public const int OptionsFieldNumber = 3;
+ private global::Google.Protobuf.Reflection.EnumOptions options_;
+ internal global::Google.Protobuf.Reflection.EnumOptions Options {
+ get { return options_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ options_ = value;
+ }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as EnumDescriptorProto);
+ }
+
+ 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;
+ }
+
+ 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;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ 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);
+ }
+ }
+
+ 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;
+ }
+
+ 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);
+ }
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ 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;
+ }
+ }
+ }
+ }
+
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class EnumValueDescriptorProto : pb::IMessage<EnumValueDescriptorProto> {
+ private static readonly pb::MessageParser<EnumValueDescriptorProto> _parser = new pb::MessageParser<EnumValueDescriptorProto>(() => new EnumValueDescriptorProto());
+ public static pb::MessageParser<EnumValueDescriptorProto> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "name", "number", "options" };
+ private static readonly uint[] _fieldTags = new uint[] { 10, 16, 26 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[6]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_EnumValueDescriptorProto__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public EnumValueDescriptorProto() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ public EnumValueDescriptorProto(EnumValueDescriptorProto other) : this() {
+ name_ = other.name_;
+ number_ = other.number_;
+ Options = other.options_ != null ? other.Options.Clone() : null;
+ }
+
+ public EnumValueDescriptorProto Clone() {
+ return new EnumValueDescriptorProto(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ if (options_ != null) Options.Freeze();
+ }
+
+ public const int NameFieldNumber = 1;
+ private string name_ = "";
+ internal string Name {
+ get { return name_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ name_ = value ?? "";
+ }
+ }
+
+ public const int NumberFieldNumber = 2;
+ private int number_;
+ internal int Number {
+ get { return number_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ number_ = value;
+ }
+ }
+
+ public const int OptionsFieldNumber = 3;
+ private global::Google.Protobuf.Reflection.EnumValueOptions options_;
+ internal global::Google.Protobuf.Reflection.EnumValueOptions Options {
+ get { return options_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ options_ = value;
+ }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as EnumValueDescriptorProto);
+ }
+
+ 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;
+ }
+
+ 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;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ 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);
+ }
+ }
+
+ 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;
+ }
+
+ 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);
+ }
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ 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;
+ }
+ }
+ }
+ }
+
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class ServiceDescriptorProto : pb::IMessage<ServiceDescriptorProto> {
+ private static readonly pb::MessageParser<ServiceDescriptorProto> _parser = new pb::MessageParser<ServiceDescriptorProto>(() => new ServiceDescriptorProto());
+ public static pb::MessageParser<ServiceDescriptorProto> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "method", "name", "options" };
+ private static readonly uint[] _fieldTags = new uint[] { 18, 10, 26 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[7]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_ServiceDescriptorProto__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public ServiceDescriptorProto() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ public ServiceDescriptorProto(ServiceDescriptorProto other) : this() {
+ name_ = other.name_;
+ method_ = other.method_.Clone();
+ Options = other.options_ != null ? other.Options.Clone() : null;
+ }
+
+ public ServiceDescriptorProto Clone() {
+ return new ServiceDescriptorProto(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ method_.Freeze();
+ if (options_ != null) Options.Freeze();
+ }
+
+ public const int NameFieldNumber = 1;
+ private string name_ = "";
+ internal string Name {
+ get { return name_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ name_ = value ?? "";
+ }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.MethodDescriptorProto> Method {
+ get { return method_; }
+ }
+
+ public const int OptionsFieldNumber = 3;
+ private global::Google.Protobuf.Reflection.ServiceOptions options_;
+ internal global::Google.Protobuf.Reflection.ServiceOptions Options {
+ get { return options_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ options_ = value;
+ }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as ServiceDescriptorProto);
+ }
+
+ 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;
+ }
+
+ 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;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ 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);
+ }
+ }
+
+ 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;
+ }
+
+ 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);
+ }
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ 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;
+ }
+ }
+ }
+ }
+
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class MethodDescriptorProto : pb::IMessage<MethodDescriptorProto> {
+ private static readonly pb::MessageParser<MethodDescriptorProto> _parser = new pb::MessageParser<MethodDescriptorProto>(() => new MethodDescriptorProto());
+ public static pb::MessageParser<MethodDescriptorProto> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "client_streaming", "input_type", "name", "options", "output_type", "server_streaming" };
+ private static readonly uint[] _fieldTags = new uint[] { 40, 18, 10, 34, 26, 48 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[8]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_MethodDescriptorProto__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public MethodDescriptorProto() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ 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_;
+ }
+
+ public MethodDescriptorProto Clone() {
+ return new MethodDescriptorProto(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ if (options_ != null) Options.Freeze();
+ }
+
+ public const int NameFieldNumber = 1;
+ private string name_ = "";
+ internal string Name {
+ get { return name_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ name_ = value ?? "";
+ }
+ }
+
+ public const int InputTypeFieldNumber = 2;
+ private string inputType_ = "";
+ internal string InputType {
+ get { return inputType_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ inputType_ = value ?? "";
+ }
+ }
+
+ public const int OutputTypeFieldNumber = 3;
+ private string outputType_ = "";
+ internal string OutputType {
+ get { return outputType_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ outputType_ = value ?? "";
+ }
+ }
+
+ public const int OptionsFieldNumber = 4;
+ private global::Google.Protobuf.Reflection.MethodOptions options_;
+ internal global::Google.Protobuf.Reflection.MethodOptions Options {
+ get { return options_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ options_ = value;
+ }
+ }
+
+ public const int ClientStreamingFieldNumber = 5;
+ private bool clientStreaming_;
+ internal bool ClientStreaming {
+ get { return clientStreaming_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ clientStreaming_ = value;
+ }
+ }
+
+ public const int ServerStreamingFieldNumber = 6;
+ private bool serverStreaming_;
+ internal bool ServerStreaming {
+ get { return serverStreaming_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ serverStreaming_ = value;
+ }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as MethodDescriptorProto);
+ }
+
+ 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;
+ }
+
+ 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;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ 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);
+ }
+ }
+
+ 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;
+ }
+
+ 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;
+ }
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ 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;
+ }
+ }
+ }
+ }
+
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class FileOptions : pb::IMessage<FileOptions> {
+ private static readonly pb::MessageParser<FileOptions> _parser = new pb::MessageParser<FileOptions>(() => new FileOptions());
+ public static pb::MessageParser<FileOptions> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "cc_enable_arenas", "cc_generic_services", "csharp_namespace", "deprecated", "go_package", "java_generate_equals_and_hash", "java_generic_services", "java_multiple_files", "java_outer_classname", "java_package", "java_string_check_utf8", "objc_class_prefix", "optimize_for", "py_generic_services", "uninterpreted_option" };
+ private static readonly uint[] _fieldTags = new uint[] { 248, 128, 298, 184, 90, 160, 136, 80, 66, 10, 216, 290, 72, 144, 7994 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[9]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_FileOptions__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public FileOptions() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ 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();
+ }
+
+ public FileOptions Clone() {
+ return new FileOptions(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ uninterpretedOption_.Freeze();
+ }
+
+ public const int JavaPackageFieldNumber = 1;
+ private string javaPackage_ = "";
+ internal string JavaPackage {
+ get { return javaPackage_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ javaPackage_ = value ?? "";
+ }
+ }
+
+ public const int JavaOuterClassnameFieldNumber = 8;
+ private string javaOuterClassname_ = "";
+ internal string JavaOuterClassname {
+ get { return javaOuterClassname_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ javaOuterClassname_ = value ?? "";
+ }
+ }
+
+ public const int JavaMultipleFilesFieldNumber = 10;
+ private bool javaMultipleFiles_;
+ internal bool JavaMultipleFiles {
+ get { return javaMultipleFiles_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ javaMultipleFiles_ = value;
+ }
+ }
+
+ public const int JavaGenerateEqualsAndHashFieldNumber = 20;
+ private bool javaGenerateEqualsAndHash_;
+ internal bool JavaGenerateEqualsAndHash {
+ get { return javaGenerateEqualsAndHash_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ javaGenerateEqualsAndHash_ = value;
+ }
+ }
+
+ public const int JavaStringCheckUtf8FieldNumber = 27;
+ private bool javaStringCheckUtf8_;
+ internal bool JavaStringCheckUtf8 {
+ get { return javaStringCheckUtf8_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ javaStringCheckUtf8_ = value;
+ }
+ }
+
+ public const int OptimizeForFieldNumber = 9;
+ private global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode optimizeFor_ = global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode.SPEED;
+ internal global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode OptimizeFor {
+ get { return optimizeFor_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ optimizeFor_ = value;
+ }
+ }
+
+ public const int GoPackageFieldNumber = 11;
+ private string goPackage_ = "";
+ internal string GoPackage {
+ get { return goPackage_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ goPackage_ = value ?? "";
+ }
+ }
+
+ public const int CcGenericServicesFieldNumber = 16;
+ private bool ccGenericServices_;
+ internal bool CcGenericServices {
+ get { return ccGenericServices_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ ccGenericServices_ = value;
+ }
+ }
+
+ public const int JavaGenericServicesFieldNumber = 17;
+ private bool javaGenericServices_;
+ internal bool JavaGenericServices {
+ get { return javaGenericServices_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ javaGenericServices_ = value;
+ }
+ }
+
+ public const int PyGenericServicesFieldNumber = 18;
+ private bool pyGenericServices_;
+ internal bool PyGenericServices {
+ get { return pyGenericServices_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ pyGenericServices_ = value;
+ }
+ }
+
+ public const int DeprecatedFieldNumber = 23;
+ private bool deprecated_;
+ internal bool Deprecated {
+ get { return deprecated_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ deprecated_ = value;
+ }
+ }
+
+ public const int CcEnableArenasFieldNumber = 31;
+ private bool ccEnableArenas_;
+ internal bool CcEnableArenas {
+ get { return ccEnableArenas_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ ccEnableArenas_ = value;
+ }
+ }
+
+ public const int ObjcClassPrefixFieldNumber = 36;
+ private string objcClassPrefix_ = "";
+ internal string ObjcClassPrefix {
+ get { return objcClassPrefix_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ objcClassPrefix_ = value ?? "";
+ }
+ }
+
+ public const int CsharpNamespaceFieldNumber = 37;
+ private string csharpNamespace_ = "";
+ internal string CsharpNamespace {
+ get { return csharpNamespace_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ csharpNamespace_ = value ?? "";
+ }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
+ get { return uninterpretedOption_; }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as FileOptions);
+ }
+
+ 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;
+ }
+
+ 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 != global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode.SPEED) 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;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ 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 != global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode.SPEED) {
+ 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);
+ }
+
+ 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 != global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode.SPEED) {
+ 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;
+ }
+
+ 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 != global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode.SPEED) {
+ 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_);
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ 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
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public static partial class Types {
+ internal enum OptimizeMode {
+ SPEED = 1,
+ CODE_SIZE = 2,
+ LITE_RUNTIME = 3,
+ }
+
+ }
+ #endregion
+
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class MessageOptions : pb::IMessage<MessageOptions> {
+ private static readonly pb::MessageParser<MessageOptions> _parser = new pb::MessageParser<MessageOptions>(() => new MessageOptions());
+ public static pb::MessageParser<MessageOptions> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "deprecated", "map_entry", "message_set_wire_format", "no_standard_descriptor_accessor", "uninterpreted_option" };
+ private static readonly uint[] _fieldTags = new uint[] { 24, 56, 8, 16, 7994 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[10]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_MessageOptions__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public MessageOptions() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ public MessageOptions(MessageOptions other) : this() {
+ messageSetWireFormat_ = other.messageSetWireFormat_;
+ noStandardDescriptorAccessor_ = other.noStandardDescriptorAccessor_;
+ deprecated_ = other.deprecated_;
+ mapEntry_ = other.mapEntry_;
+ uninterpretedOption_ = other.uninterpretedOption_.Clone();
+ }
+
+ public MessageOptions Clone() {
+ return new MessageOptions(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ uninterpretedOption_.Freeze();
+ }
+
+ public const int MessageSetWireFormatFieldNumber = 1;
+ private bool messageSetWireFormat_;
+ internal bool MessageSetWireFormat {
+ get { return messageSetWireFormat_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ messageSetWireFormat_ = value;
+ }
+ }
+
+ public const int NoStandardDescriptorAccessorFieldNumber = 2;
+ private bool noStandardDescriptorAccessor_;
+ internal bool NoStandardDescriptorAccessor {
+ get { return noStandardDescriptorAccessor_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ noStandardDescriptorAccessor_ = value;
+ }
+ }
+
+ public const int DeprecatedFieldNumber = 3;
+ private bool deprecated_;
+ internal bool Deprecated {
+ get { return deprecated_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ deprecated_ = value;
+ }
+ }
+
+ public const int MapEntryFieldNumber = 7;
+ private bool mapEntry_;
+ internal bool MapEntry {
+ get { return mapEntry_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ mapEntry_ = value;
+ }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
+ get { return uninterpretedOption_; }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as MessageOptions);
+ }
+
+ 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;
+ }
+
+ 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;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ 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);
+ }
+
+ 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;
+ }
+
+ 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_);
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ 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;
+ }
+ }
+ }
+ }
+
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class FieldOptions : pb::IMessage<FieldOptions> {
+ private static readonly pb::MessageParser<FieldOptions> _parser = new pb::MessageParser<FieldOptions>(() => new FieldOptions());
+ public static pb::MessageParser<FieldOptions> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "ctype", "deprecated", "jstype", "lazy", "packed", "uninterpreted_option", "weak" };
+ private static readonly uint[] _fieldTags = new uint[] { 8, 24, 48, 40, 16, 7994, 80 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[11]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_FieldOptions__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public FieldOptions() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ 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();
+ }
+
+ public FieldOptions Clone() {
+ return new FieldOptions(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ uninterpretedOption_.Freeze();
+ }
+
+ public const int CtypeFieldNumber = 1;
+ private global::Google.Protobuf.Reflection.FieldOptions.Types.CType ctype_ = global::Google.Protobuf.Reflection.FieldOptions.Types.CType.STRING;
+ internal global::Google.Protobuf.Reflection.FieldOptions.Types.CType Ctype {
+ get { return ctype_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ ctype_ = value;
+ }
+ }
+
+ public const int PackedFieldNumber = 2;
+ private bool packed_;
+ internal bool Packed {
+ get { return packed_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ packed_ = value;
+ }
+ }
+
+ public const int JstypeFieldNumber = 6;
+ private global::Google.Protobuf.Reflection.FieldOptions.Types.JSType jstype_ = global::Google.Protobuf.Reflection.FieldOptions.Types.JSType.JS_NORMAL;
+ internal global::Google.Protobuf.Reflection.FieldOptions.Types.JSType Jstype {
+ get { return jstype_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ jstype_ = value;
+ }
+ }
+
+ public const int LazyFieldNumber = 5;
+ private bool lazy_;
+ internal bool Lazy {
+ get { return lazy_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ lazy_ = value;
+ }
+ }
+
+ public const int DeprecatedFieldNumber = 3;
+ private bool deprecated_;
+ internal bool Deprecated {
+ get { return deprecated_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ deprecated_ = value;
+ }
+ }
+
+ public const int WeakFieldNumber = 10;
+ private bool weak_;
+ internal bool Weak {
+ get { return weak_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ weak_ = value;
+ }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
+ get { return uninterpretedOption_; }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as FieldOptions);
+ }
+
+ 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;
+ }
+
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Ctype != global::Google.Protobuf.Reflection.FieldOptions.Types.CType.STRING) hash ^= Ctype.GetHashCode();
+ if (Packed != false) hash ^= Packed.GetHashCode();
+ if (Jstype != global::Google.Protobuf.Reflection.FieldOptions.Types.JSType.JS_NORMAL) 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;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Ctype != global::Google.Protobuf.Reflection.FieldOptions.Types.CType.STRING) {
+ 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 != global::Google.Protobuf.Reflection.FieldOptions.Types.JSType.JS_NORMAL) {
+ output.WriteRawTag(48);
+ output.WriteEnum((int) Jstype);
+ }
+ if (Weak != false) {
+ output.WriteRawTag(80);
+ output.WriteBool(Weak);
+ }
+ uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
+ }
+
+ public int CalculateSize() {
+ int size = 0;
+ if (Ctype != global::Google.Protobuf.Reflection.FieldOptions.Types.CType.STRING) {
+ size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Ctype);
+ }
+ if (Packed != false) {
+ size += 1 + 1;
+ }
+ if (Jstype != global::Google.Protobuf.Reflection.FieldOptions.Types.JSType.JS_NORMAL) {
+ 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;
+ }
+
+ public void MergeFrom(FieldOptions other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Ctype != global::Google.Protobuf.Reflection.FieldOptions.Types.CType.STRING) {
+ Ctype = other.Ctype;
+ }
+ if (other.Packed != false) {
+ Packed = other.Packed;
+ }
+ if (other.Jstype != global::Google.Protobuf.Reflection.FieldOptions.Types.JSType.JS_NORMAL) {
+ 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_);
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ 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
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public static partial class Types {
+ internal enum CType {
+ STRING = 0,
+ CORD = 1,
+ STRING_PIECE = 2,
+ }
+
+ internal enum JSType {
+ JS_NORMAL = 0,
+ JS_STRING = 1,
+ JS_NUMBER = 2,
+ }
+
+ }
+ #endregion
+
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class EnumOptions : pb::IMessage<EnumOptions> {
+ private static readonly pb::MessageParser<EnumOptions> _parser = new pb::MessageParser<EnumOptions>(() => new EnumOptions());
+ public static pb::MessageParser<EnumOptions> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "allow_alias", "deprecated", "uninterpreted_option" };
+ private static readonly uint[] _fieldTags = new uint[] { 16, 24, 7994 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[12]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_EnumOptions__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public EnumOptions() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ public EnumOptions(EnumOptions other) : this() {
+ allowAlias_ = other.allowAlias_;
+ deprecated_ = other.deprecated_;
+ uninterpretedOption_ = other.uninterpretedOption_.Clone();
+ }
+
+ public EnumOptions Clone() {
+ return new EnumOptions(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ uninterpretedOption_.Freeze();
+ }
+
+ public const int AllowAliasFieldNumber = 2;
+ private bool allowAlias_;
+ internal bool AllowAlias {
+ get { return allowAlias_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ allowAlias_ = value;
+ }
+ }
+
+ public const int DeprecatedFieldNumber = 3;
+ private bool deprecated_;
+ internal bool Deprecated {
+ get { return deprecated_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ deprecated_ = value;
+ }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
+ get { return uninterpretedOption_; }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as EnumOptions);
+ }
+
+ 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;
+ }
+
+ public override int GetHashCode() {
+ int hash = 1;
+ if (AllowAlias != false) hash ^= AllowAlias.GetHashCode();
+ if (Deprecated != false) hash ^= Deprecated.GetHashCode();
+ hash ^= uninterpretedOption_.GetHashCode();
+ return hash;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ 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);
+ }
+
+ 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;
+ }
+
+ 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_);
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ break;
+ case 16: {
+ AllowAlias = input.ReadBool();
+ break;
+ }
+ case 24: {
+ Deprecated = input.ReadBool();
+ break;
+ }
+ case 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class EnumValueOptions : pb::IMessage<EnumValueOptions> {
+ private static readonly pb::MessageParser<EnumValueOptions> _parser = new pb::MessageParser<EnumValueOptions>(() => new EnumValueOptions());
+ public static pb::MessageParser<EnumValueOptions> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "deprecated", "uninterpreted_option" };
+ private static readonly uint[] _fieldTags = new uint[] { 8, 7994 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[13]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_EnumValueOptions__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public EnumValueOptions() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ public EnumValueOptions(EnumValueOptions other) : this() {
+ deprecated_ = other.deprecated_;
+ uninterpretedOption_ = other.uninterpretedOption_.Clone();
+ }
+
+ public EnumValueOptions Clone() {
+ return new EnumValueOptions(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ uninterpretedOption_.Freeze();
+ }
+
+ public const int DeprecatedFieldNumber = 1;
+ private bool deprecated_;
+ internal bool Deprecated {
+ get { return deprecated_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ deprecated_ = value;
+ }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
+ get { return uninterpretedOption_; }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as EnumValueOptions);
+ }
+
+ 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;
+ }
+
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Deprecated != false) hash ^= Deprecated.GetHashCode();
+ hash ^= uninterpretedOption_.GetHashCode();
+ return hash;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Deprecated != false) {
+ output.WriteRawTag(8);
+ output.WriteBool(Deprecated);
+ }
+ uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
+ }
+
+ public int CalculateSize() {
+ int size = 0;
+ if (Deprecated != false) {
+ size += 1 + 1;
+ }
+ size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
+ return size;
+ }
+
+ public void MergeFrom(EnumValueOptions other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Deprecated != false) {
+ Deprecated = other.Deprecated;
+ }
+ uninterpretedOption_.Add(other.uninterpretedOption_);
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ break;
+ case 8: {
+ Deprecated = input.ReadBool();
+ break;
+ }
+ case 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class ServiceOptions : pb::IMessage<ServiceOptions> {
+ private static readonly pb::MessageParser<ServiceOptions> _parser = new pb::MessageParser<ServiceOptions>(() => new ServiceOptions());
+ public static pb::MessageParser<ServiceOptions> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "deprecated", "uninterpreted_option" };
+ private static readonly uint[] _fieldTags = new uint[] { 264, 7994 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[14]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_ServiceOptions__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public ServiceOptions() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ public ServiceOptions(ServiceOptions other) : this() {
+ deprecated_ = other.deprecated_;
+ uninterpretedOption_ = other.uninterpretedOption_.Clone();
+ }
+
+ public ServiceOptions Clone() {
+ return new ServiceOptions(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ uninterpretedOption_.Freeze();
+ }
+
+ public const int DeprecatedFieldNumber = 33;
+ private bool deprecated_;
+ internal bool Deprecated {
+ get { return deprecated_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ deprecated_ = value;
+ }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
+ get { return uninterpretedOption_; }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as ServiceOptions);
+ }
+
+ 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;
+ }
+
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Deprecated != false) hash ^= Deprecated.GetHashCode();
+ hash ^= uninterpretedOption_.GetHashCode();
+ return hash;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Deprecated != false) {
+ output.WriteRawTag(136, 2);
+ output.WriteBool(Deprecated);
+ }
+ uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
+ }
+
+ public int CalculateSize() {
+ int size = 0;
+ if (Deprecated != false) {
+ size += 2 + 1;
+ }
+ size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
+ return size;
+ }
+
+ public void MergeFrom(ServiceOptions other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Deprecated != false) {
+ Deprecated = other.Deprecated;
+ }
+ uninterpretedOption_.Add(other.uninterpretedOption_);
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ break;
+ case 264: {
+ Deprecated = input.ReadBool();
+ break;
+ }
+ case 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class MethodOptions : pb::IMessage<MethodOptions> {
+ private static readonly pb::MessageParser<MethodOptions> _parser = new pb::MessageParser<MethodOptions>(() => new MethodOptions());
+ public static pb::MessageParser<MethodOptions> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "deprecated", "uninterpreted_option" };
+ private static readonly uint[] _fieldTags = new uint[] { 264, 7994 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[15]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_MethodOptions__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public MethodOptions() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ public MethodOptions(MethodOptions other) : this() {
+ deprecated_ = other.deprecated_;
+ uninterpretedOption_ = other.uninterpretedOption_.Clone();
+ }
+
+ public MethodOptions Clone() {
+ return new MethodOptions(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ uninterpretedOption_.Freeze();
+ }
+
+ public const int DeprecatedFieldNumber = 33;
+ private bool deprecated_;
+ internal bool Deprecated {
+ get { return deprecated_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ deprecated_ = value;
+ }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption> UninterpretedOption {
+ get { return uninterpretedOption_; }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as MethodOptions);
+ }
+
+ 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;
+ }
+
+ public override int GetHashCode() {
+ int hash = 1;
+ if (Deprecated != false) hash ^= Deprecated.GetHashCode();
+ hash ^= uninterpretedOption_.GetHashCode();
+ return hash;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ public void WriteTo(pb::CodedOutputStream output) {
+ if (Deprecated != false) {
+ output.WriteRawTag(136, 2);
+ output.WriteBool(Deprecated);
+ }
+ uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec);
+ }
+
+ public int CalculateSize() {
+ int size = 0;
+ if (Deprecated != false) {
+ size += 2 + 1;
+ }
+ size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec);
+ return size;
+ }
+
+ public void MergeFrom(MethodOptions other) {
+ if (other == null) {
+ return;
+ }
+ if (other.Deprecated != false) {
+ Deprecated = other.Deprecated;
+ }
+ uninterpretedOption_.Add(other.uninterpretedOption_);
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ break;
+ case 264: {
+ Deprecated = input.ReadBool();
+ break;
+ }
+ case 7994: {
+ uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class UninterpretedOption : pb::IMessage<UninterpretedOption> {
+ private static readonly pb::MessageParser<UninterpretedOption> _parser = new pb::MessageParser<UninterpretedOption>(() => new UninterpretedOption());
+ public static pb::MessageParser<UninterpretedOption> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "aggregate_value", "double_value", "identifier_value", "name", "negative_int_value", "positive_int_value", "string_value" };
+ private static readonly uint[] _fieldTags = new uint[] { 66, 49, 26, 18, 40, 32, 58 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[16]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_UninterpretedOption__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public UninterpretedOption() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ 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_;
+ }
+
+ public UninterpretedOption Clone() {
+ return new UninterpretedOption(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ name_.Freeze();
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart> Name {
+ get { return name_; }
+ }
+
+ public const int IdentifierValueFieldNumber = 3;
+ private string identifierValue_ = "";
+ internal string IdentifierValue {
+ get { return identifierValue_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ identifierValue_ = value ?? "";
+ }
+ }
+
+ public const int PositiveIntValueFieldNumber = 4;
+ private ulong positiveIntValue_;
+ internal ulong PositiveIntValue {
+ get { return positiveIntValue_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ positiveIntValue_ = value;
+ }
+ }
+
+ public const int NegativeIntValueFieldNumber = 5;
+ private long negativeIntValue_;
+ internal long NegativeIntValue {
+ get { return negativeIntValue_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ negativeIntValue_ = value;
+ }
+ }
+
+ public const int DoubleValueFieldNumber = 6;
+ private double doubleValue_;
+ internal double DoubleValue {
+ get { return doubleValue_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ doubleValue_ = value;
+ }
+ }
+
+ public const int StringValueFieldNumber = 7;
+ private pb::ByteString stringValue_ = pb::ByteString.Empty;
+ internal pb::ByteString StringValue {
+ get { return stringValue_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ stringValue_ = value ?? pb::ByteString.Empty;
+ }
+ }
+
+ public const int AggregateValueFieldNumber = 8;
+ private string aggregateValue_ = "";
+ internal string AggregateValue {
+ get { return aggregateValue_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ aggregateValue_ = value ?? "";
+ }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as UninterpretedOption);
+ }
+
+ 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;
+ }
+
+ 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;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ 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);
+ }
+ }
+
+ 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;
+ }
+
+ 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;
+ }
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ 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
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public static partial class Types {
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class NamePart : pb::IMessage<NamePart> {
+ private static readonly pb::MessageParser<NamePart> _parser = new pb::MessageParser<NamePart>(() => new NamePart());
+ public static pb::MessageParser<NamePart> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "is_extension", "name_part" };
+ private static readonly uint[] _fieldTags = new uint[] { 16, 10 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.UninterpretedOption.Descriptor.NestedTypes[0]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_UninterpretedOption_NamePart__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public NamePart() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ public NamePart(NamePart other) : this() {
+ namePart_ = other.namePart_;
+ isExtension_ = other.isExtension_;
+ }
+
+ public NamePart Clone() {
+ return new NamePart(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ }
+
+ public const int NamePart_FieldNumber = 1;
+ private string namePart_ = "";
+ internal string NamePart_ {
+ get { return namePart_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ namePart_ = value ?? "";
+ }
+ }
+
+ public const int IsExtensionFieldNumber = 2;
+ private bool isExtension_;
+ internal bool IsExtension {
+ get { return isExtension_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ isExtension_ = value;
+ }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as NamePart);
+ }
+
+ 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;
+ }
+
+ public override int GetHashCode() {
+ int hash = 1;
+ if (NamePart_.Length != 0) hash ^= NamePart_.GetHashCode();
+ if (IsExtension != false) hash ^= IsExtension.GetHashCode();
+ return hash;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ 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);
+ }
+ }
+
+ public int CalculateSize() {
+ int size = 0;
+ if (NamePart_.Length != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(NamePart_);
+ }
+ if (IsExtension != false) {
+ size += 1 + 1;
+ }
+ return size;
+ }
+
+ public void MergeFrom(NamePart other) {
+ if (other == null) {
+ return;
+ }
+ if (other.NamePart_.Length != 0) {
+ NamePart_ = other.NamePart_;
+ }
+ if (other.IsExtension != false) {
+ IsExtension = other.IsExtension;
+ }
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ break;
+ case 10: {
+ NamePart_ = input.ReadString();
+ break;
+ }
+ case 16: {
+ IsExtension = input.ReadBool();
+ break;
+ }
+ }
+ }
+ }
+
+ }
+
+ }
+ #endregion
+
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class SourceCodeInfo : pb::IMessage<SourceCodeInfo> {
+ private static readonly pb::MessageParser<SourceCodeInfo> _parser = new pb::MessageParser<SourceCodeInfo>(() => new SourceCodeInfo());
+ public static pb::MessageParser<SourceCodeInfo> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "location" };
+ private static readonly uint[] _fieldTags = new uint[] { 10 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.Descriptor.MessageTypes[17]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_SourceCodeInfo__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public SourceCodeInfo() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ public SourceCodeInfo(SourceCodeInfo other) : this() {
+ location_ = other.location_.Clone();
+ }
+
+ public SourceCodeInfo Clone() {
+ return new SourceCodeInfo(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ location_.Freeze();
+ }
+
+ 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>();
+ internal pbc::RepeatedField<global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location> Location {
+ get { return location_; }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as SourceCodeInfo);
+ }
+
+ 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;
+ }
+
+ public override int GetHashCode() {
+ int hash = 1;
+ hash ^= location_.GetHashCode();
+ return hash;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ public void WriteTo(pb::CodedOutputStream output) {
+ location_.WriteTo(output, _repeated_location_codec);
+ }
+
+ public int CalculateSize() {
+ int size = 0;
+ size += location_.CalculateSize(_repeated_location_codec);
+ return size;
+ }
+
+ public void MergeFrom(SourceCodeInfo other) {
+ if (other == null) {
+ return;
+ }
+ location_.Add(other.location_);
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ break;
+ case 10: {
+ location_.AddEntriesFrom(input, _repeated_location_codec);
+ break;
+ }
+ }
+ }
+ }
+
+ #region Nested types
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public static partial class Types {
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal sealed partial class Location : pb::IMessage<Location> {
+ private static readonly pb::MessageParser<Location> _parser = new pb::MessageParser<Location>(() => new Location());
+ public static pb::MessageParser<Location> Parser { get { return _parser; } }
+
+ private static readonly string[] _fieldNames = new string[] { "leading_comments", "leading_detached_comments", "path", "span", "trailing_comments" };
+ private static readonly uint[] _fieldTags = new uint[] { 26, 50, 10, 18, 34 };
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::Google.Protobuf.Reflection.SourceCodeInfo.Descriptor.NestedTypes[0]; }
+ }
+
+ pbr::FieldAccessorTable pb::IReflectedMessage.Fields {
+ get { return global::Google.Protobuf.Reflection.DescriptorProtoFile.internal__static_google_protobuf_SourceCodeInfo_Location__FieldAccessorTable; }
+ }
+
+ private bool _frozen = false;
+ public bool IsFrozen { get { return _frozen; } }
+
+ public Location() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ public Location(Location other) : this() {
+ path_ = other.path_.Clone();
+ span_ = other.span_.Clone();
+ leadingComments_ = other.leadingComments_;
+ trailingComments_ = other.trailingComments_;
+ leadingDetachedComments_ = other.leadingDetachedComments_.Clone();
+ }
+
+ public Location Clone() {
+ return new Location(this);
+ }
+
+ public void Freeze() {
+ if (IsFrozen) {
+ return;
+ }
+ _frozen = true;
+ path_.Freeze();
+ span_.Freeze();
+ leadingDetachedComments_.Freeze();
+ }
+
+ 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>();
+ internal pbc::RepeatedField<int> Path {
+ get { return path_; }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<int> Span {
+ get { return span_; }
+ }
+
+ public const int LeadingCommentsFieldNumber = 3;
+ private string leadingComments_ = "";
+ internal string LeadingComments {
+ get { return leadingComments_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ leadingComments_ = value ?? "";
+ }
+ }
+
+ public const int TrailingCommentsFieldNumber = 4;
+ private string trailingComments_ = "";
+ internal string TrailingComments {
+ get { return trailingComments_; }
+ set {
+ pb::Freezable.CheckMutable(this);
+ trailingComments_ = value ?? "";
+ }
+ }
+
+ 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>();
+ internal pbc::RepeatedField<string> LeadingDetachedComments {
+ get { return leadingDetachedComments_; }
+ }
+
+ public override bool Equals(object other) {
+ return Equals(other as Location);
+ }
+
+ 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;
+ }
+
+ 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;
+ }
+
+ public override string ToString() {
+ return pb::JsonFormatter.Default.Format(this);
+ }
+
+ 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);
+ }
+
+ 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;
+ }
+
+ 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_);
+ }
+
+ public void MergeFrom(pb::CodedInputStream input) {
+ uint tag;
+ while (input.ReadTag(out tag)) {
+ switch(tag) {
+ case 0:
+ throw pb::InvalidProtocolBufferException.InvalidTag();
+ default:
+ if (pb::WireFormat.IsEndGroupTag(tag)) {
+ return;
+ }
+ 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
+
+ }
+
+ #endregion
+
+}
+
+#endregion Designer generated code
diff --git a/csharp/src/Google.Protobuf/Reflection/DescriptorUtil.cs b/csharp/src/Google.Protobuf/Reflection/DescriptorUtil.cs
new file mode 100644
index 00000000..af31dfb1
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/DescriptorUtil.cs
@@ -0,0 +1,65 @@
+#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..bf8f8c83
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs
@@ -0,0 +1,108 @@
+#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;
+
+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;
+
+ internal EnumDescriptor(EnumDescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int index)
+ : base(file, file.ComputeFullName(parent, proto.Name), index)
+ {
+ this.proto = proto;
+ 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; } }
+
+ /// <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..29833c4a
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs
@@ -0,0 +1,61 @@
+#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; } }
+
+ public override string Name { get { return proto.Name; } }
+
+ public int Number { get { return Proto.Number; } }
+
+ 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..39a63b47
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/FieldAccessorBase.cs
@@ -0,0 +1,67 @@
+#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;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Base class for field accessors.
+ /// </summary>
+ internal abstract class FieldAccessorBase : IFieldAccessor
+ {
+ private readonly Func<object, object> getValueDelegate;
+ private readonly FieldDescriptor descriptor;
+
+ internal FieldAccessorBase(Type type, string propertyName, FieldDescriptor descriptor)
+ {
+ PropertyInfo property = type.GetProperty(propertyName);
+ if (property == null || !property.CanRead)
+ {
+ throw new ArgumentException("Not all required properties/methods available");
+ }
+ this.descriptor = descriptor;
+ getValueDelegate = ReflectionUtil.CreateFuncObjectObject(property.GetGetMethod());
+ }
+
+ public FieldDescriptor Descriptor { get { return descriptor; } }
+
+ public object GetValue(object message)
+ {
+ return getValueDelegate(message);
+ }
+
+ public abstract void Clear(object message);
+ public abstract void SetValue(object message, object value);
+ }
+}
diff --git a/csharp/src/Google.Protobuf/Reflection/FieldAccessorTable.cs b/csharp/src/Google.Protobuf/Reflection/FieldAccessorTable.cs
new file mode 100644
index 00000000..24fcbc64
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/FieldAccessorTable.cs
@@ -0,0 +1,97 @@
+#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.ObjectModel;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Provides access to fields in generated messages via reflection.
+ /// </summary>
+ public sealed class FieldAccessorTable
+ {
+ private readonly ReadOnlyCollection<IFieldAccessor> accessors;
+ private readonly ReadOnlyCollection<OneofAccessor> oneofs;
+ private readonly MessageDescriptor descriptor;
+
+ /// <summary>
+ /// Constructs a FieldAccessorTable for a particular message class.
+ /// Only one FieldAccessorTable should be constructed per class.
+ /// </summary>
+ /// <param name="type">The CLR type for the message.</param>
+ /// <param name="descriptor">The type's descriptor</param>
+ /// <param name="propertyNames">The Pascal-case names of all the field-based properties in the message.</param>
+ public FieldAccessorTable(Type type, MessageDescriptor descriptor, string[] propertyNames, string[] oneofPropertyNames)
+ {
+ this.descriptor = descriptor;
+ var accessorsArray = new IFieldAccessor[descriptor.Fields.Count];
+ for (int i = 0; i < accessorsArray.Length; i++)
+ {
+ var field = descriptor.Fields[i];
+ var name = propertyNames[i];
+ accessorsArray[i] =
+ field.IsMap ? new MapFieldAccessor(type, name, field)
+ : field.IsRepeated ? new RepeatedFieldAccessor(type, name, field)
+ : (IFieldAccessor) new SingleFieldAccessor(type, name, field);
+ }
+ accessors = new ReadOnlyCollection<IFieldAccessor>(accessorsArray);
+ var oneofsArray = new OneofAccessor[descriptor.Oneofs.Count];
+ for (int i = 0; i < oneofsArray.Length; i++)
+ {
+ var oneof = descriptor.Oneofs[i];
+ oneofsArray[i] = new OneofAccessor(type, oneofPropertyNames[i], oneof);
+ }
+ oneofs = new ReadOnlyCollection<OneofAccessor>(oneofsArray);
+ }
+
+ // TODO: Validate the name here... should possibly make this type a more "general reflection access" type,
+ // bearing in mind the oneof parts to come as well.
+ /// <summary>
+ /// Returns all of the field accessors for the message type.
+ /// </summary>
+ public ReadOnlyCollection<IFieldAccessor> Accessors { get { return accessors; } }
+
+ public ReadOnlyCollection<OneofAccessor> Oneofs { get { return oneofs; } }
+
+ // TODO: Review this, as it's easy to get confused between FieldNumber and Index.
+ // Currently only used to get an accessor related to a oneof... maybe just make that simpler?
+ public IFieldAccessor this[int fieldNumber]
+ {
+ get
+ {
+ FieldDescriptor field = descriptor.FindFieldByNumber(fieldNumber);
+ return accessors[field.Index];
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
new file mode 100644
index 00000000..3d9d0d75
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
@@ -0,0 +1,292 @@
+#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>
+ /// Descriptor for a field or extension within a message in a .proto file.
+ /// </summary>
+ public sealed class FieldDescriptor : DescriptorBase, IComparable<FieldDescriptor>
+ {
+ private readonly FieldDescriptorProto proto;
+ private EnumDescriptor enumType;
+ private MessageDescriptor messageType;
+ private readonly MessageDescriptor containingType;
+ private readonly OneofDescriptor containingOneof;
+ private FieldType fieldType;
+
+ internal FieldDescriptor(FieldDescriptorProto proto, FileDescriptor file,
+ MessageDescriptor parent, int index)
+ : base(file, file.ComputeFullName(parent, proto.Name), index)
+ {
+ this.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);
+ }
+
+ /// <summary>
+ /// The brief name of the descriptor's target.
+ /// </summary>
+ public override string Name { get { return proto.Name; } }
+
+ internal FieldDescriptorProto Proto { get { return proto; } }
+
+ /// <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.TYPE_DOUBLE:
+ return FieldType.Double;
+ case FieldDescriptorProto.Types.Type.TYPE_FLOAT:
+ return FieldType.Float;
+ case FieldDescriptorProto.Types.Type.TYPE_INT64:
+ return FieldType.Int64;
+ case FieldDescriptorProto.Types.Type.TYPE_UINT64:
+ return FieldType.UInt64;
+ case FieldDescriptorProto.Types.Type.TYPE_INT32:
+ return FieldType.Int32;
+ case FieldDescriptorProto.Types.Type.TYPE_FIXED64:
+ return FieldType.Fixed64;
+ case FieldDescriptorProto.Types.Type.TYPE_FIXED32:
+ return FieldType.Fixed32;
+ case FieldDescriptorProto.Types.Type.TYPE_BOOL:
+ return FieldType.Bool;
+ case FieldDescriptorProto.Types.Type.TYPE_STRING:
+ return FieldType.String;
+ case FieldDescriptorProto.Types.Type.TYPE_GROUP:
+ return FieldType.Group;
+ case FieldDescriptorProto.Types.Type.TYPE_MESSAGE:
+ return FieldType.Message;
+ case FieldDescriptorProto.Types.Type.TYPE_BYTES:
+ return FieldType.Bytes;
+ case FieldDescriptorProto.Types.Type.TYPE_UINT32:
+ return FieldType.UInt32;
+ case FieldDescriptorProto.Types.Type.TYPE_ENUM:
+ return FieldType.Enum;
+ case FieldDescriptorProto.Types.Type.TYPE_SFIXED32:
+ return FieldType.SFixed32;
+ case FieldDescriptorProto.Types.Type.TYPE_SFIXED64:
+ return FieldType.SFixed64;
+ case FieldDescriptorProto.Types.Type.TYPE_SINT32:
+ return FieldType.SInt32;
+ case FieldDescriptorProto.Types.Type.TYPE_SINT64:
+ return FieldType.SInt64;
+ default:
+ throw new ArgumentException("Invalid type specified");
+ }
+ }
+
+ public bool IsRepeated
+ {
+ get { return Proto.Label == FieldDescriptorProto.Types.Label.LABEL_REPEATED; }
+ }
+
+ public bool IsMap
+ {
+ get { return fieldType == FieldType.Message && messageType.Proto.Options != null && messageType.Proto.Options.MapEntry; }
+ }
+
+ public bool IsPacked
+ {
+ get { return Proto.Options != null && Proto.Options.Packed; }
+ }
+
+ /// <summary>
+ /// Get the field's containing type. For extensions, this is the type being
+ /// extended, not the location where the extension was defined. See
+ /// <see cref="ExtensionScope" />.
+ /// </summary>
+ public MessageDescriptor ContainingType
+ {
+ get { return containingType; }
+ }
+
+ public OneofDescriptor ContainingOneof
+ {
+ get { return containingOneof; }
+ }
+
+ public FieldType FieldType
+ {
+ get { return fieldType; }
+ }
+
+ public int FieldNumber
+ {
+ get { return 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 enum 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.");
+ }
+ }
+ }
+} \ 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..41fa702d
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/FieldType.cs
@@ -0,0 +1,60 @@
+#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. The odd formatting is to make it very clear
+ /// which attribute applies to which value, while maintaining a compact format.
+ /// </summary>
+ public enum FieldType
+ {
+ Double,
+ Float,
+ Int64,
+ UInt64,
+ Int32,
+ Fixed64,
+ Fixed32,
+ Bool,
+ String,
+ Group,
+ Message,
+ Bytes,
+ UInt32,
+ SFixed32,
+ SFixed64,
+ SInt32,
+ SInt64,
+ 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..db393480
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs
@@ -0,0 +1,352 @@
+#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 readonly FileDescriptorProto proto;
+ private readonly IList<MessageDescriptor> messageTypes;
+ private readonly IList<EnumDescriptor> enumTypes;
+ private readonly IList<ServiceDescriptor> services;
+ private readonly IList<FileDescriptor> dependencies;
+ private readonly IList<FileDescriptor> publicDependencies;
+ private readonly DescriptorPool pool;
+
+ public enum ProtoSyntax
+ {
+ Proto2,
+ Proto3
+ }
+
+ public ProtoSyntax Syntax
+ {
+ get { return proto.Syntax == "proto3" ? ProtoSyntax.Proto3 : ProtoSyntax.Proto2; }
+ }
+
+ private FileDescriptor(FileDescriptorProto proto, FileDescriptor[] dependencies, DescriptorPool pool, bool allowUnknownDependencies)
+ {
+ this.pool = pool;
+ this.proto = proto;
+ this.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));
+
+ enumTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.EnumType,
+ (enumType, index) =>
+ new EnumDescriptor(enumType, this, null, 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 { return proto; }
+ }
+
+ /// <value>
+ /// The file name.
+ /// </value>
+ public string Name
+ {
+ get { return 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
+ {
+ get { return proto.Package; }
+ }
+
+ /// <value>
+ /// Unmodifiable list of top-level message types declared in this file.
+ /// </value>
+ public IList<MessageDescriptor> MessageTypes
+ {
+ get { return messageTypes; }
+ }
+
+ /// <value>
+ /// Unmodifiable list of top-level enum types declared in this file.
+ /// </value>
+ public IList<EnumDescriptor> EnumTypes
+ {
+ get { return enumTypes; }
+ }
+
+ /// <value>
+ /// Unmodifiable list of top-level services declared in this file.
+ /// </value>
+ public IList<ServiceDescriptor> Services
+ {
+ get { return services; }
+ }
+
+ /// <value>
+ /// Unmodifiable list of this file's dependencies (imports).
+ /// </value>
+ public IList<FileDescriptor> Dependencies
+ {
+ get { return dependencies; }
+ }
+
+ /// <value>
+ /// Unmodifiable list of this file's public dependencies (public imports).
+ /// </value>
+ public IList<FileDescriptor> PublicDependencies
+ {
+ get { return publicDependencies; }
+ }
+
+ /// <value>
+ /// Implementation of IDescriptor.FullName - just returns the same as Name.
+ /// </value>
+ string IDescriptor.FullName
+ {
+ get { return Name; }
+ }
+
+ /// <value>
+ /// Implementation of IDescriptor.File - just returns this descriptor.
+ /// </value>
+ FileDescriptor IDescriptor.File
+ {
+ get { return this; }
+ }
+
+ /// <value>
+ /// Pool containing symbol descriptors.
+ /// </value>
+ internal DescriptorPool DescriptorPool
+ {
+ get { return pool; }
+ }
+
+ /// <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 (or ITypeDescriptor for any)</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 = pool.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="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>
+ /// <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(FileDescriptorProto proto, FileDescriptor[] dependencies, bool allowUnknownDependencies)
+ {
+ // 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(proto, dependencies, pool, allowUnknownDependencies);
+
+ // TODO(jonskeet): Reinstate these checks, or get rid of them entirely. They aren't in the Java code,
+ // and fail for the CustomOptions test right now. (We get "descriptor.proto" vs "google/protobuf/descriptor.proto".)
+ //if (dependencies.Length != proto.DependencyCount)
+ //{
+ // throw new DescriptorValidationException(result,
+ // "Dependencies passed to FileDescriptor.BuildFrom() don't match " +
+ // "those listed in the FileDescriptorProto.");
+ //}
+ //for (int i = 0; i < proto.DependencyCount; i++)
+ //{
+ // if (dependencies[i].Name != proto.DependencyList[i])
+ // {
+ // throw new DescriptorValidationException(result,
+ // "Dependencies passed to FileDescriptor.BuildFrom() don't match " +
+ // "those listed in the FileDescriptorProto.");
+ // }
+ //}
+
+ result.CrossLink();
+ return result;
+ }
+
+ private void CrossLink()
+ {
+ foreach (MessageDescriptor message in messageTypes)
+ {
+ message.CrossLink();
+ }
+
+ foreach (ServiceDescriptor service in services)
+ {
+ service.CrossLink();
+ }
+ }
+
+ public static FileDescriptor InternalBuildGeneratedFileFrom(byte[] descriptorData,
+ FileDescriptor[] dependencies)
+ {
+ 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(proto, dependencies, true);
+ }
+ catch (DescriptorValidationException e)
+ {
+ throw new ArgumentException("Invalid embedded descriptor for \"" + proto.Name + "\".", e);
+ }
+ }
+
+ public override string ToString()
+ {
+ return "FileDescriptor for " + proto.Name;
+ }
+ }
+} \ 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..6506db1b
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/IDescriptor.cs
@@ -0,0 +1,44 @@
+#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
+ {
+ string Name { get; }
+ string FullName { get; }
+ 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..3f4f05f4
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/IFieldAccessor.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>
+ /// Allows fields to be reflectively accessed.
+ /// </summary>
+ public interface IFieldAccessor
+ {
+ /// <summary>
+ /// Returns the descriptor associated with this field.
+ /// </summary>
+ FieldDescriptor Descriptor { get; }
+
+ // TODO: Should the argument type for these messages be IReflectedMessage?
+
+ /// <summary>
+ /// Clears the field in the specified message. (For repeated fields,
+ /// this clears the list.)
+ /// </summary>
+ void Clear(object 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(object 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, or the message is frozen.</exception>
+ void SetValue(object 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..317fbd8d
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/MapFieldAccessor.cs
@@ -0,0 +1,58 @@
+#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;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Accessor for map fields.
+ /// </summary>
+ internal sealed class MapFieldAccessor : FieldAccessorBase
+ {
+ internal MapFieldAccessor(Type type, string propertyName, FieldDescriptor descriptor) : base(type, propertyName, descriptor)
+ {
+ }
+
+ public override void Clear(object message)
+ {
+ IDictionary list = (IDictionary) GetValue(message);
+ list.Clear();
+ }
+
+ public override void SetValue(object 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..b6351d36
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs
@@ -0,0 +1,172 @@
+#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 message type.
+ /// </summary>
+ public sealed class MessageDescriptor : DescriptorBase
+ {
+ private readonly DescriptorProto proto;
+ private readonly MessageDescriptor containingType;
+ private readonly IList<MessageDescriptor> nestedTypes;
+ private readonly IList<EnumDescriptor> enumTypes;
+ private readonly IList<FieldDescriptor> fields;
+ private readonly IList<OneofDescriptor> oneofs;
+
+ internal MessageDescriptor(DescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int typeIndex)
+ : base(file, file.ComputeFullName(parent, proto.Name), typeIndex)
+ {
+ this.proto = proto;
+ containingType = parent;
+
+ oneofs = DescriptorUtil.ConvertAndMakeReadOnly(proto.OneofDecl,
+ (oneof, index) =>
+ new OneofDescriptor(oneof, file, this, index));
+
+ nestedTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.NestedType,
+ (type, index) =>
+ new MessageDescriptor(type, file, this, index));
+
+ enumTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.EnumType,
+ (type, index) =>
+ new EnumDescriptor(type, file, this, index));
+
+ // TODO(jonskeet): Sort fields first?
+ fields = DescriptorUtil.ConvertAndMakeReadOnly(proto.Field,
+ (field, index) =>
+ new FieldDescriptor(field, file, this, index));
+ file.DescriptorPool.AddSymbol(this);
+ }
+
+ /// <summary>
+ /// The brief name of the descriptor's target.
+ /// </summary>
+ public override string Name { get { return proto.Name; } }
+
+ internal DescriptorProto Proto { get { return proto; } }
+
+ /// <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 this message type's fields.
+ /// </value>
+ public IList<FieldDescriptor> Fields
+ {
+ get { return fields; }
+ }
+
+ /// <value>
+ /// An unmodifiable list of this message type's nested types.
+ /// </value>
+ public IList<MessageDescriptor> NestedTypes
+ {
+ get { return nestedTypes; }
+ }
+
+ /// <value>
+ /// An unmodifiable list of this message type's enum types.
+ /// </value>
+ public IList<EnumDescriptor> EnumTypes
+ {
+ get { return enumTypes; }
+ }
+
+ public IList<OneofDescriptor> Oneofs
+ {
+ get { return oneofs; }
+ }
+
+ /// <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)
+ {
+ return 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)
+ {
+ return 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
+ {
+ return 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 fields)
+ {
+ field.CrossLink();
+ }
+
+ foreach (OneofDescriptor oneof in oneofs)
+ {
+ oneof.CrossLink();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs
new file mode 100644
index 00000000..0c9c6949
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs
@@ -0,0 +1,93 @@
+#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; } }
+
+ 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..7a11d36b
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/OneofAccessor.cs
@@ -0,0 +1,85 @@
+#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;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Reflection access for a oneof, allowing clear and "get case" actions.
+ /// </summary>
+ public sealed class OneofAccessor
+ {
+ private readonly Func<object, int> caseDelegate;
+ private readonly Action<object> clearDelegate;
+ private OneofDescriptor descriptor;
+
+ internal OneofAccessor(Type type, string propertyName, OneofDescriptor descriptor)
+ {
+ PropertyInfo property = type.GetProperty(propertyName + "Case");
+ if (property == null || !property.CanRead)
+ {
+ throw new ArgumentException("Not all required properties/methods available");
+ }
+ this.descriptor = descriptor;
+ caseDelegate = ReflectionUtil.CreateFuncObjectT<int>(property.GetGetMethod());
+
+ this.descriptor = descriptor;
+ MethodInfo clearMethod = type.GetMethod("Clear" + propertyName);
+ clearDelegate = ReflectionUtil.CreateActionObject(clearMethod);
+ }
+
+ public OneofDescriptor Descriptor { get { return descriptor; } }
+
+ /// <summary>
+ /// Clears the oneof in the specified message.
+ /// </summary>
+ public void Clear(object message)
+ {
+ clearDelegate(message);
+ }
+
+ /// <summary>
+ /// Indicates which field in the oneof is set for specified message
+ /// </summary>
+ public FieldDescriptor GetCaseFieldDescriptor(object 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..e92dc8bb
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs
@@ -0,0 +1,78 @@
+#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;
+
+namespace Google.Protobuf.Reflection
+{
+ public sealed class OneofDescriptor : DescriptorBase
+ {
+ private readonly OneofDescriptorProto proto;
+ private MessageDescriptor containingType;
+ private IList<FieldDescriptor> fields;
+
+ internal OneofDescriptor(OneofDescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int index)
+ : base(file, file.ComputeFullName(parent, proto.Name), index)
+ {
+ this.proto = proto;
+ containingType = parent;
+
+ file.DescriptorPool.AddSymbol(this);
+ }
+
+ /// <summary>
+ /// The brief name of the descriptor's target.
+ /// </summary>
+ public override string Name { get { return proto.Name; } }
+
+ public MessageDescriptor ContainingType
+ {
+ get { return containingType; }
+ }
+
+ public IList<FieldDescriptor> Fields { get { return fields; } }
+
+ internal void CrossLink()
+ {
+ List<FieldDescriptor> fieldCollection = new List<FieldDescriptor>();
+ foreach (var field in ContainingType.Fields)
+ {
+ if (field.ContainingOneof == this)
+ {
+ fieldCollection.Add(field);
+ }
+ }
+ fields = new ReadOnlyCollection<FieldDescriptor>(fieldCollection);
+ }
+ }
+}
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..c7ed4342
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/PartialClasses.cs
@@ -0,0 +1,47 @@
+#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;
+ }
+ }
+} \ 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..d0dc3e8b
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs
@@ -0,0 +1,106 @@
+#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.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<object, object> CreateFuncObjectObject(MethodInfo method)
+ {
+ ParameterExpression parameter = Expression.Parameter(typeof(object), "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<object, 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<object, T> CreateFuncObjectT<T>(MethodInfo method)
+ {
+ ParameterExpression parameter = Expression.Parameter(typeof(object), "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<object, 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<object, object> CreateActionObjectObject(MethodInfo method)
+ {
+ ParameterExpression targetParameter = Expression.Parameter(typeof(object), "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<object, 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<object> CreateActionObject(MethodInfo method)
+ {
+ ParameterExpression targetParameter = Expression.Parameter(typeof(object), "target");
+ Expression castTarget = Expression.Convert(targetParameter, method.DeclaringType);
+ Expression call = Expression.Call(castTarget, method);
+ return Expression.Lambda<Action<object>>(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..0ada7567
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/RepeatedFieldAccessor.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;
+
+namespace Google.Protobuf.Reflection
+{
+ /// <summary>
+ /// Accessor for repeated fields.
+ /// </summary>
+ internal sealed class RepeatedFieldAccessor : FieldAccessorBase
+ {
+ internal RepeatedFieldAccessor(Type type, string propertyName, FieldDescriptor descriptor) : base(type, propertyName, descriptor)
+ {
+ }
+
+ public override void Clear(object message)
+ {
+ IList list = (IList) GetValue(message);
+ list.Clear();
+ }
+
+ public override void SetValue(object 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..8c24e46e
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs
@@ -0,0 +1,85 @@
+#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;
+
+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<object, object> setValueDelegate;
+ private readonly Action<object> clearDelegate;
+
+ internal SingleFieldAccessor(Type type, string propertyName, FieldDescriptor descriptor) : base(type, propertyName, descriptor)
+ {
+ PropertyInfo property = type.GetProperty(propertyName);
+ // We know there *is* such a property, or the base class constructor would have thrown. We should be able to write
+ // to it though.
+ if (!property.CanWrite)
+ {
+ throw new ArgumentException("Not all required properties/methods available");
+ }
+ setValueDelegate = ReflectionUtil.CreateActionObjectObject(property.GetSetMethod());
+
+ var clrType = property.PropertyType;
+
+ // TODO: What should clear on a oneof member do? Clear the oneof?
+
+ // TODO: Validate that this is a reasonable single field? (Should be a value type, a message type, or string/ByteString.)
+ object defaultValue =
+ typeof(IMessage).IsAssignableFrom(clrType) ? null
+ : clrType == typeof(string) ? ""
+ : clrType == typeof(ByteString) ? ByteString.Empty
+ : Activator.CreateInstance(clrType);
+ clearDelegate = message => SetValue(message, defaultValue);
+ }
+
+ public override void Clear(object message)
+ {
+ clearDelegate(message);
+ }
+
+ public override void SetValue(object message, object value)
+ {
+ setValueDelegate(message, value);
+ }
+ }
+}